Thumbnailing with NetPBM and Movable Type

Written by Shanx April 21st, 2003

Thumbnailing with NetPBM and Movable Type

Continue reading →
Close

One of the most useful applications of MT is to set up an online pictures diary and using all the in-built features for photosharing. Problem is that despite mt-check.cgi recognizing Image::Magick on your server, you cannot create thumbnails (you only end up with the dreaded 500 server error). Guess what, just as efficient as imagemagick are the NetPBM libraries and this little tutorial should have you working in no time.

So you have MovableType and cannot get it to support thumbnailing with either Image::Magick or with NetPBM? This is a tutorial to help you work with NetPBM,
Imagemagick is for another day. (PS: From my experience, there is no noticeable
difference in the operational efficiency or speed of using either, in case that
is what you were worried about).

So, let’s get cracking.

  1. First, you need NetPBM binaries. Many webhosts may have installed the libraries
    but the binaries for NetPBM are small and cute, so it doesn’t really hurt
    to have your own. Grab the NetPBM binaries from here.

    Note: This is in Windows ZIP format, if you need gzipped versions please write to
    me, or grab them off NetPBM‘s
    website.
  2. Unzip these files (they will create a NetPBM folder) and ftp the folder
    to your web server. Let us say you upload them into your folder within your
    MT folder as follows:

    /home/DOMAIN/www/mt/netpbm
  3. Now, you need to set CHMOD all files inside netpbm to 755 (executable). Assuming you are into your netpbm folder,
    chmod 755 *
  4. To make sure that the binaries are in proper order, try checking on some of the included binaries:
    ./jpegtopnm -version

    or

    ./pnmcut -version

  5. Assuming that you see the info about the utils you tested (as above), we now need to make sure MT recognizes *your* NetPBM. TO do this, open your mt.cfg and modify the following two options:
    ImageDriver NetPBM
    NetPBMPath /home/DOMAIN/www/mt/netpbm
  6. Upload your mt.cfg. Let’s check if MT can indeed find your NetPBM. From within your MT folder (one up from NetPBM folder), execute the following command in your shell –
    perl -Iextlib -MIPC::Run -e 1
  7. If you are lucky (and you should be, really, in most cases) then you are
    all set — you can try the UPLOAD FILE from your MT now. If you have problems
    here, let me know. It is usually related to IPC::Run but hopefully this shouldn’t be required.
    TIP: If you encounter IPC errors, ONLY THEN follow the next step.
  8. Perform the following steps ONLY if you experience the IPC error outlined in step 7 –
    1. Get IPC files: http://sniptools.com/av/IPC.zip
    2. Unzip it, it will create an IPC folder.
    3. Upload the IPC folder as-is to your MT/extlib directory.

Time to start thumbnailing!

Posted in Miscellaneous

143 Comments

Tagged with

143 Comments

  1. sniptools says:

    Hi Michael,

    What happens if you move the whole IPC folder to:

    –> /var/www/html/blog/extlib/IPC

    Let me know.

    Shanx

  2. Michael says:

    Well I moved IPC to /var/www/html/blog/extlib/IPC
    and I can run perl -Iextlib -MIPC::Run -e 1 in both the /var/www/html/blog and /var/www/html/blog/extlib directories without error.

    However, there is still no thumbnail option when uploading images in MT :(

    Note: the extlib subdirectory was added to /var/www/html/blog merely to follow your suggestion, it previously did not exist

    Maybe it would helpful if I described the contents of /var/www/html/blog and /var/www/html/blog/cgi-bin

    /var/www/html/blog contains all the blog’s html, templates, style sheets and syndication feeds.

    /var/www/html/blog/cgi-bin contains mt.cfg, cgi files, lib, tmpl, and well basically everything else.

    Is there any chance that if my host has NetPBM installed elsewhere there would be a conflict and thus MT is bypassing the thumbnail feature?

    Any further assistance/suggestions would be greatly appreciated.

    Thanks.

    -Michael

  3. Michael says:

    Wow!!! It finally is working! Thanks for the tutorial!

    Turns out I had to declare the path name to NetPBM from the root of server in the configuration file. Elsewhere in the file I only declare paths from the root of my account. Oh well, it works!

  4. sniptools says:

    Glad to hear that Michael. The next thing I was going to suggest was to confirm your cfg file. Anyway, all that ends well..

  5. gatta says:

    for those of you who use netpbm & experience this after pressing “popup” or “embed” butto:

    Broken pipe: write ((gibberish gibberish gibberish lots and lots of gibberish))

    It’s probably because that programs like jpegtopnm fails to run (libraries linking problems). try do a ldd on jpegtopnm and you may see that it can’t find some libraries.

  6. chris says:

    Grrr!
    I’ve read the post, read all the comments, followed all directions.

    I do not receive the IPC error, it’s just that nothing has changed in my upload options at all. Exactly the same. No option for thumbnailing.

    I’ve changed my cfg file, I’ve set permissions on the binaries, I’ve done it all. Grrr.

    The only thing I could not do was check the binaries in my “shell”. In fact, I don’t even know what that means!

  7. chris says:

    Turns out my solution was the same as Michael’s. I thought I’d tried that, but I guess not! Path to NetPBM from the root of the server…

    Thanks for this tutorial. I can’t wait to get going.

  8. Yoto says:

    After reading this fine tutorial and doing it more than 40 times and reading everyone comments i give up :( My MT refuses to show the Thumbnail option when i upload a image :(

    Just to get this clear i did install NetPBM in my public html directory (who is called simple “www”)and chmod it 755. My final path is this one:

    /www/NetPBM

    Next i have edited MT.CFG and changed the lines “ImageDriver NetPBM” (i simple removed the #) and changed the NetPBMPath to NetPBMPath /www/NetPBM/ (also removing the #)

    Since i don’t have shell access i tried to do an upload of a picture… And them nothing :( No Thumbnail option :(

    I checked if my webserve had IPC::Run perl module and since it doesn’t i have installed it on the /cgi-bin/MT/extlib/ folder having in the final this folder /cgi-bin/MT/extlib/IPC

    And still nothing :( I also have checked my full paht to my server (in this case /mnt/web_j/d40/s40/a000k508/www) and changed the NetPBMPath to /mnt/web_j/d40/s40/a000k508/www/NetPBMPath and still no luck :(

    I’m almost giving up and i hope some one can see what I’m doing wrong and tell me…

    Btw, my MT version is 2.64.

    Thansk!

  9. sniptools says:

    Yoto, what happens when you remove the last slash from your “NetPBMPath /www/NetPBM/” ?

  10. Yoto says:

    Hi Shashank!

    If i remove the slash i still don’t get the thumbnail option… i also did the same thing using full NetPBMPath /mnt/web_j/d40/s40/a000k508/www/NetPBM and it also didn’t show the option :(

    Btw, thanks for you help :)

  11. Morgan says:

    I wish I found this tutorial 10 hours ago. I’ve been sitting here all day frustrated beyond belief because I couldn’t get Image::Magick or my NETPBM file’s to work.

    THANK YOU SO MUCH!!

  12. Jonny says:

    Thanks for this! This site comes up nicely on Google when you search for Movable Type & NetPBM so found it easily and got it all working within five minutes!

    Thanks from the UK!

  13. Donald Kramer says:

    Image::Magick on Windows and MT: As it said on the old Image::Magick Perl site the directory where the DLLs are located is finicky. Try copying all of the DLLs into C:\Perl\site\lib\auto\Image\Magick or just C:\Perl it should work fine

    http://www.dylanbeattie.net/magick/debug.html

    quite possibly it is the same issue with Unix as well, perhaps the executables must also be located in the associated directory. Just a thought.

  14. ChrisWDP says:

    I’ve been trying to get NetPBM to work on a Windows 2003 server. I have followed the instructions and I am receiving the following errors when I run #6:

    Prototype mismatch: sub Socket::IPPROTO_TCP > vs none at C:/Perl/lib/Socket.pm line 395

    Prototype mismatch: sub Socket::TCP_NODELAY > vs none at C:/Perl/lib/Socket.pm line 395

    If I try to upload a picture in MT, this message shows under the two buttons for pop-up and embedded image.

    Any ideas on what is causing this? Thanks.

  15. orangeguru says:

    Thanks for the great tutorial. Too bad I can’t check if MT find netpbm (no shell access).

    So I installed IPC::Run as well. Still no luck.

    mt-medic at least says the config is ok, the paths and permissions are fine as well.

    MT 3.121 really ‘breaks’ a lot of things that have been working perfectly with MT 2.61 – including image upload and XML-RPC (I had to install SOAP lite – grrrrrr!).

    Once again thanks!

  16. Feri says:

    Thanks for your perfect instructions. I just install it on Mt 3.121 with IPC folder. Every thing is fine and I have my Thumbnail as well. But at the bottom of the pop-up window, there is an unlimited line of errors like these:

    Pseudo-hashes are deprecated at extlib/IPC/Run.pm line 2452.
    Pseudo-hashes are deprecated at (eval 14) line 68.
    Pseudo-hashes are deprecated at extlib/IPC/Run/IO.pm line 556.
    extlib/IPC/Run/IO.pm line 563.
    Pseudo-hashes are deprecated at extlib/IPC/Run.pm line 3003.

    Any suggestions to solve this?

  17. Thumbnailing with NetPBM and Movable Type

    Tutorial NetPBM mit Movabletype Wer statt Image::Magick das Perl Modul NetPBM verwenden will wird hier glcklich werden……

  18. Arthur Che says:

    Hi,

    I read your very useful tutorial about MT and NetPBM. I’ve followed all the instructions, and now I get it to let me try and create a thumbnail, but when I click “pop up image” or “embedded image,” I get the Broken Pipe error that a few on the thread have gotten. Do you have any idea for a fix for this? Any help is greatly appreciated!

    Thanks :)


    Arthur Che
    arthur.che@gmail.com
    http:// http://www.arthurhungry.com /

  19. jummy says:

    I’m utterly frustrated that your straightforward instructions don’t seem to help me. I emailed you, Shanx, and I hope you have a chance to respond to me sometime soon.

    Many thanks.

  20. Jonathan says:

    My host said “netpbm is install and all commands are in /usr/local/bin,” yet when I take out the #’s in the mt.cfg file, I receive the following when try to access mt.cfg.

    Got an error: ./mt.cfg:317: variable ‘NetPBM’ not defined

    What’s that about?

  21. Jonathan says:

    Sorry, I meant when trying to access http://www.shrued.com/mt.cgi

  22. Alius Maximus says:

    Hello Shashank and thanks for this usufull tutorial, I don’t know if you still answer to the problems concerning this tutorial or not, but I have to try anyways!

    I have done all what you said (except the 6th one because I don’t have Shell access to my server), Now I can see thumbnail choice in upload image popup but when I click thumbnail it gives me this error message:

    exec failed: Permission denied at lib/MT/Image.pm line 126 at lib/MT/Image.pm line 126 exec failed: Permission denied at lib/MT/Image.pm line 126 at lib/MT/Image.pm line 126

    I saw that someone else had the same problem but couldn’t find any answer from you in the comments. would be really gratefull if you can help me in this regard…

    thanks again
    cheers

  23. Runa says:

    Hello there Shashank:

    I tried to install the NetPBM tool following your instructions but it does not work. I am running MT 3.16 with dynamic publishing on a Windows 2003 Server, running php.

    In the mt.cfg file, here is what I have:

    ImageDriver NetPBM
    NetPBMPath /cgi-bin/mt/netpbm

    Should I have uploaded the NetPBM files to /mt-static, which is outside the cgi-bin folder, instead of the above?

    I have also uploaded the IPC files to:

    /cgi-bin/mt/extlib/IPC

    Then in /cgi-bin/mt/ I ran this command:

    perl -Iextlib -MIPC::Run -e 1

    and this is the error I get:

    Prototype mismatch: sub Socket::IPPROTO_TCP > none at c:/Perl/lib/Socket.pm line 395.

    Any help will be much appreciated.

    Indebted to you.

    –R.

  24. sniptools says:

    Hello Runa, what version of Perl are you using?

  25. Runa says:

    Hello Shashank:

    Perl version: 5.8.6

    –R.

  26. sniptools says:

    Hi Runa,

    Those are warnings rather than errors. Do they block NetPBM from working at all?

    [Rant]This Socket.pm problem is one of the many reasons Perl is a PITA and many people use the ilk of PHP. [/Rant]

    I frankly don’t have time to help out any more, but a meaningless question – have you tried Image::Magick? It could be a lot simpler yet help you do whatever you want to do with NetPBM.

    Shashank

  27. Chris Henry says:

    Excellent tutorial. Was able to get this up and running on my site in minutes, after spending hours tring to get ImageMagick to work.

    Thanks a ton!

  28. Mathieu says:

    I seem to be getting the same error as Greenlander and sam !

    I get the thumbnail option to show up now, but when I hit “popup” or “embed” the next screen I see is:
    Broken pipe: write ((gibberish gibberish gibberish lots and lots of gibberish))
    at extlib/IPC/Run/IO.pm line 582

    Any thoughts for this unresolved problem?
    Thanks a lot !

  29. George says:

    Works like a charm. Thanks a lot! Great work.

  30. hello
    your post are very coool
    i install netpdm in 20 min.

    works really good.

    very thks.

  31. Jay Brewer says:

    Wow. This worked like a charm. The big thing – putting the two lines inthe mt.cfg file on two lines.

    mageDriver NetPBM
    NetPBMPath /cgi-bin/mt/netpbm

  32. andy says:

    Hey these instructions helped a lot. Thanks!

  33. Mike says:

    Still working like a champ!!! Had to do the IPC part, and it immediately fixed it!

    Thanks a ton!

  34. Nick G says:

    Thank you so so much. It took some monkeying around but, I finally got the sucker installed right. I have two questions for you though:

    1.) Are there any features in netpbm that will allow the user to look at a preview of the thumbnail before they upload it, I’d think it would be ideal to get a preview function, cause as it is now, I am really guessing on the right percentages of my thumbnails.

    2.) Do you mind if I link to your downloads link to the netpbm zipped file, if you do would you mind if I uploaded the file to my own server and let them download it from there. Pretty much the situation is, I have just started messing around with MT and figured as I figured out certain things I’d post blog/tutorials on the very same blog I was working on. I’d give the link to this article if you wanted, I just wanted to get the ok, don’t wanna step on anybody’s toes.

  35. Nick says:

    Thank you so so much. It took some monkeying around but, I finally got the sucker installed right. I have two questions for you though:

    1.) Are there any features in netpbm that will allow the user to look at a preview of the thumbnail before they upload it, I’d think it would be ideal to get a preview function, cause as it is now, I am really guessing on the right percentages of my thumbnails.

    2.) Do you mind if I link to your downloads link to the netpbm zipped file, if you do would you mind if I uploaded the file to my own server and let them download it from there. Pretty much the situation is, I have just started messing around with MT and figured as I figured out certain things I’d post blog/tutorials on the very same blog I was working on. I’d give the link to this article if you wanted, I just wanted to get the ok, don’t wanna step on anybody’s toes.

  36. sniptools says:

    Nick, sure, you can link to the article and make the zipped file downloadable.

  37. Laurea says:

    Your plug-in works great! I was able to install it successfully. Thanks for the tutorial!

    I do wonder though if there is a way to customize NetPBM so that it generates the thumbnail image code and then *inserts the code into the entry* so that you don’t have to to click “show me the html.”

    I know that clicking “create new entry” inserts the thumbnail image code into the entry, but lets say you want to upload multiple pictures into the same entry and you want the code for each thumbnail image you upload to be inserted into the entry.

    Is there a way to customize NetPBM do what i described above?

    A live example of this description would be in Typepad. When you insert an image in a post, the image code is inserted for you into the entry, and you can upload multiple images and Typepad continues to insert the image code for each image uploaded into the single entry.

    I would appreciate any pointers or resources to check out.

    Thanks!

  38. Jane says:

    At you the excellent site, a lot of useful info and good design, thank.

  39. ulrika says:

    Arrghhh
    I used your instructions with ultimate succsess on my OLD MT installation.
    Then I installed 3.2 and…..well Net Pbm DOES NOT work in that either….!! So I tried first with MT s soluton (only IPC) broken pipe- I did your solution with new files and all an I get broken pipe12. I really have tried everything, checked that I didn’t di any mistakes in mt.cfg or whatever, and uploaded fresh files again in binary mode etc etc.
    IS there anything else I could do?
    Does NOBODY really know what is wrong? In this?
    Hopeful
    u

  40. When using NetPBM and png’s you need to change line 1xx (122 I think) in Image.pm:

    my %Types = (jpg => ‘jpeg’, gif => ‘gif’);

    To

    my %Types = (jpg => ‘jpeg’, gif => ‘gif’, png => ‘png’);

    Otherwise you will might get a “file not found: /users/home/etc/netpbm/topnm”

    http://forums.sixapart.com/index.php?showtopic=54246 >

  41. aidan says:

    this worked perfectly, thanks!

  42. Thanks, worked great on the jumpline redhat VDS servers!

  43. Phill Mayer says:

    I followed these instructions to get NETPBM working, but I messed up somewhere

    Here is the mt-config:

    ImageDriver NetPBM
    NetPBMPath http://76.124.218.15:1226/cgi-bin/mt/netpbm

    The NetPMB folder is in the cgi-bin\mt\forlder

    IPC is in the mt/extlib folder
    IPC is in the perl/site/lib folder
    IPC is in the perl/lib folder

    When I run perl -Iextlib -MIPC::Run -e 1
    I get prototype mismatch errors

    When I try to upload an image, I get no option to create a thumbnail.

    What am I doing wrong?

Leave a Reply

Miscellaneous

I use the Nokia e61i as my mobile. Instead of my telco’s data plan (which offers me a meagre 1GB per month) I simply prefer to use my home wireless [...]

Continue reading →

View all

Web Tools

If you use Firefox (and if not, what are you waiting for?) you are familiar with useful extensions such as Video Downloader, which allow you to save local copies of [...]

Continue reading →

View all

Databases

This regexp worked for me. SELECT * FROM table WHERE NOT column ~ ( ‘^(‘|| $$[\09\0A\0D\x20-\x7E]|$$|| — ASCII $$[\xC2-\xDF][\x80-\xBF]|$$|| — non-overlong 2-byte $$\xE0[\xA0-\xBF][\x80-\xBF]|$$|| — excluding overlongs $$[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|$$|| — straight 3-byte [...]

Continue reading →

View all

Windows

So you’ve been visited by the much dreaded CRC — Cyclical Redundancy Check error, most likely encountered while copying files between hard disks. On Mac OSX, this will usually appear [...]

Continue reading →

View all

Mac OSX

A simple app ought to do it. Download iRinger. It’s a Windows app. If you’re on Mac, you’ll want to use it within a virtual machine, like Parallels or VMWare [...]

Continue reading →

View all

System Maintenance

I use the Nokia e61i as my mobile. Instead of my telco’s data plan (which offers me a meagre 1GB per month) I simply prefer to use my home wireless [...]

Continue reading →

View all

Wordpress

Among many new exciting features, WordPress 2.6 released the ability to store each and every revision of your posts, like an elaborate update history. Now this can be a pretty [...]

Continue reading →

View all

Audio/Video

Panic, the makers of some fantastic software such as Transmit or Panic, also have the most light-weight audio converter for the Mac OSX platform. It’s called Audion: get it here. [...]

Continue reading →

View all

iPhone

A simple app ought to do it. Download iRinger. It’s a Windows app. If you’re on Mac, you’ll want to use it within a virtual machine, like Parallels or VMWare [...]

Continue reading →

View all