SniptoolsSniptools | Design & Technology Observations

RSS

Thumbnailing with NetPBM and Movable Type

Apr 21st 2003
142 Comments

Respond
Trackback

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: /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!




This post is tagged

142 Comments

  1. Craig

    thanks! this was very useful for me, i have imagemagick working but couldnt get it to work with movabletype. i guess i will settle for netpbm. would be so nice if they could make their binaries a little more available!

  2. Shashank

    No worries Craig. Where is your blog located?

  3. Kate Sumbler

    Thanks for the clear instructions. I am still not able to get this to work, however… :(
    I don’t know what I am doing wrong, as I have followed the instructions (many times over, in fact) and still can’t get it to work.

    Currently, I am just getting a server error after I click the upload button. Never gets to the dialog box where I expect it should mention the thumbnail option.

    Any ideas?

  4. Kate Sumbler

    OK, I just ran the perl part from step 6 on my PC and got this error:

    C:\sambar53\perl>perl -Iextlib -MIPC::Run -e 1
    Can’t locate IPC/Run.pm in @INC (@INC contains: extlib C:/sambar53/perl/lib C:/sambar53/perl/site/lib .).
    BEGIN failed — compilation aborted.

    I installed the contents of the IPC.zip file in my MT/extlib directory and still get this same error message.

    I’m starting to think that I am just not going to be able to do the thumbnails… :(

  5. Shashank

    Kurt, looks like you are on Windows. I have thumbnailing running on Windows XP as well, so I am pretty sure it works.

    I have some questions — 1. Do you have the netpbm binaries that are compiled for Windows: http://gnuwin32.sourceforge.net/packages/netpbm.htm

    2. In your mt.cfg, what is the path you give to netpbm?

    3. In your last message, you mentioned the IPC error, this has to do with Run.pm not being found. Can you try putting IPC::Run in your “perl/site/lib” folder as well? (This is kludgish but just to see if it’ll work)

  6. Kate Sumbler

    1. I downloaded this file: http://prdownloads.sourceforge.net/gnuwin32/netpbm-10.6-bin.zip?download and unzipped it.

    2. c:\sambar53\cgi-bin\mt\netpbm If you want to see my mt-cfg details, I have installed mt-medic at this address: http://198.109.164.98/cgi-bin/mt/mt-medic.cgi (The password to login to view the configuration is ‘yasgur’)

    3. I just tried copying the IPC folder into the perl/site/lib and still get the same problem…

    Thanks for the help! -=kt=-

  7. Kate Sumbler

    OK, I hate to reply to myself, but I thought I would add this info:

    I just tried uploading a 449 KB .jpg file, and got the server error (500), but if I selected a smaller file 22KB I get the normal dialog box asking me if I want to create a popup or embedded image. But not the thumbnail prompts. So, it seems I can upload smaller images but somehow a larger one causes some kind of error.

    Maybe whatever is causing this error is also the cause of the NetPBM not working? I don’t know… I thought I’d add this since I just noticed this happening in case it might help you to help me! Thanks again for the help! -=kt=-

  8. Shashank

    Kate, I tried visiting your medic site but the password is invalid. I guess I am not interested in the entire config you have going, but only the lines for NetPBM and thumbnailing. Let me try some stuff and see if I can come up with anything.

  9. Clive Roster

    I set up my MT a month ago using these instructions and came back now because of all the kludgish workarounds, script tricks etc etc that go into making a photoalbum work with MT. If you ask me, it is just not worth it..even the thumbnaling because if I have 50 pics to upload, it gets awefully tiring to do them using the upload feature on MT. Much easier to just make them using a PS action and then let MT recognize them through the entries I create.

    Come to think of it, it is definitely worth it to roll out your own little pic album script if you can find the time. Takes a max of 1 week or so but you are free from all the quixotic pixels (if you know what I mean) type workarounds.

  10. Shashank

    Thanks for the thoughts. Yes, using mt for photoalbums soon gets pretty tiring. But for people who don’t know (or don’t want to know) coding themselves, it definitely helps to use mt or any other tool (e.g., PHP Gallery).

    As for the thumbnails, that I agree with totally. After a while thumbnailing is a lot simpler without online “intervention”. But that would defeat the purpose of this page so I’ll try to find some ideas for Kurt anyway :-)

  11. Kate Sumbler

    Hey, guess what??? After about the 1000th unsuccessful reinstall of NetPBM and IPC::Run, I finally decided to try the Image::Magick stuff again.

    Took me a couple hours, but suddenly, out of the blue, mt-check said the magick ;) words!

    Image::Magick…
    Your server has Image::Magick installed (version 5.26).

    I really have no idea what I did different this time, if it was a different version of the file or what, but Image::Magick is installed and seems to work! The only glitch I am suffering is related to my local site/archive paths in MT. My web files are on my d: drive and no matter how I configure things, the path MT creates for the thumbnail image includes the local path (d:/docs/blog…) in the middle of the URL. I can manually fix the URL before posting, so I’m considering it working!

    Thanks again for the time and effort you gave toward helping me. I really appreciated the fact that you were willing to give me a hand, even though we don’t know each other!

    Have a great day! -=kt=-

  12. monastic

    came to your page from mt forums, thx for the useful page. i got my netpbm working. can u aslo make the IPC file available in tar.gz so that linux users can also use it?

  13. Shashank

    Thanks monastic, but I guess Linux users should be savvy enough to grab a valid IPC :)

  14. Greenlander

    Shashank — thanks a lot for this page. Came from the MT forums and got lost. Too many threads with dozens of opinions but on this matter but no intelligible solutions :-)
    I still have a big problem, though, it seems. After the thumbnail options, I get this error message: >>> Broken pipe: write( 14, […] ) at /usr/home29/hinrichs/public_html/cgi-bin/movabletype/extlib/IPC/Run/IO.pm line 582

  15. Greenalnder

    Forgot to add:
    Of course I changed the mt.cfg, too. :-)

  16. Happiness is a warm blog

    I’m happy for a number of reasons. I found out that [function+delete] does a forward delete on laptop keyboards and my friend mz_informed showed me a program called uControl that lets me set [function+touchpad-drag] like a mousewheel. The way i…

  17. kiTz

    omg… thank you soO much for this page.. maN.. i could never get image::magick working.. and i could tell my admin was trying his very best to put up with all my emails.. until i found this.. i followed the instructions step by step and the darn thing finally works!! thank you so much.

  18. Ruthie

    i found this site via the MT forums. I followed your directions, but I do not get an option for thumbnails. I am at a loss here, any help would be greatly appreciated.

  19. Ruthie

    i spoke too soon. My NetPBMPath configuration setting was wrong. All is well. Sorry to have bothered you :)

  20. Oliver Link

    thanks so much for your instructions. NetPBM now works on my webserver hosted externally. I still would like to know about ImageMagick since I checked and it is installed on the server as a Perl module. any idea when you will post instructions for that?

  21. Shashank

    Oliver, I haven’t had the time to figure out why Image::Magick doesn’t work. It is installed on my systems too, but MT still refuses to recognize it. I can use Magick otherwise without a hitch so either it is an issue with Image::Magick the perl module (unlikely, I imagine) or with MT’s code (may be likely, given how many people have problems with it).

    Will let you know if I choose to investigate it any further in the future, although doesnt seem likely to be honest.

    Glad you got NetPBM working though (ditto for Ruthie).

  22. Jael

    Thank you so much for providing this tutorial!

    I downloaded all kinds of different netpm packages, and none looked like what you provided with your zip-file here. I was totally confused what I needed to upload. Having wasted two hours, with your tutorial I was set within 5 minutes! Thank you!

  23. Eva

    now I have installed like your tutorial but I got this mesaage when I tried uploading some images.

    MT::App::CMS=HASH(0x3f5708) Illegal character \015 (carriage return) at extlib/IPC/Run.pm line 1.

    Please help me cause I need the possibility to creat thumbnails with my MT.
    Thank you so much.

    Cheers Eva

  24. Shashank

    Eva, please follow the instructions on the 4th comment on this page which show you how to install your own IPC::Run stuff.