Image Thumbnail Creator

Like many other people, I found Mike Lopez’s image thumbnail script quite useful. He has taken the time to go through the brain-crunching algorithm to create image proportional image thumbnails when given a max height/width. Although this script is very handy, it was lacking in a few areas, such as transparent PNG and GIF support, as well as the un-needed resize if the image was smaller than the requested dimensions. I hope I have “helped” in this situation by modifying the script so that it handles such requests. Credit for the transparency support goes to Martin Schmidt (icheee).

One modification I made that is important to note is that the image is now fed through with the SRC variable, rather than the IMG variable. Thanks Mike for this script and I hope my updates really help.

Last Update: 2008-01-10 23:12 CST
* fixed resize issue where only 1 dimension was provided.

11 Responses

  1. Al

    You need to change the filename to download from image.php to another extension like image.phps in order for people to download…

    I can’t copy and paste the actual text above because the text because all crumpled up.

  2. Al

    I have made sure already that the image does exist. In my case, the image is on my server, but it will not always be this case. I’d like this to work with all images on any server.


  3. cici


    great script, thanks for this!!!

    need a feature, crop image


  4. Framboos

    Great script! Especially the feature to resize remote images.
    Haven’t seen that in the other scripts I’ve looked at (,

    But those scripts do have file caching, is there anyone who knows how to add that to this script? I’ve tried combining some parts but not succesfully yet, so far…

  5. Joe

    Thank you, thank you, thank you for modifying this script. It works perfectly.

  6. bjarne

    Looks very nice Brian!

    Have not tested it yet, but looks very nice. Just one question: What about at cache for the tumbnails? Is it just to change sometning in the code, make a folder (777) and it would work?

    Why cache you said? Slow remote server…


  7. Alexander

    Dear Brian, just a question since you are (and I am not, not yet) a CodeIgnitor user. I noticed that there is also an image maniputalor class in CI. Can that not do what your script above does?

    Btw, nice that you also discovered PHPDesigner 🙂

Write a Comment