Forum Moderators: coopster

Message Too Old, No Replies

PHP Image resizing *without* GD or ImageMagick

Stupid hosts.

         

bhays

11:11 pm on Apr 27, 2004 (gmt 0)

10+ Year Member



I know one of the easiest solutions would just be to switch hosts, but unfortunately the client does not think so. Alas, here we are.

Basically I need to thumbnail images that are being uploaded, I would like to resize and save them to something smaller. Is it even possible to do such in PHP without the use of GD or ImageMagic? The host is only running php 4.0.6 as well...

Thanks in advance...

ben

DrDoc

4:52 am on Apr 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure it is possible... but I'm not sure how feasible. Basically you would need to handle all the image writing yourself, handling binary content directly in your script.
Does the host have anything that can do what you want?

If not, I'd start looking for Perl/PHP modules that can do what you want. I'm not sure one even exists...

Bonusbana

3:23 pm on Apr 28, 2004 (gmt 0)

10+ Year Member



Install the GD module and the rest is done with ease. Or why not do it the retro way - resize the image in html__?

ergophobe

3:11 pm on Apr 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you have CGI capability with your account (can run binaries) you should be able to install ImageMagick or NetPBM in your own "sandbox" and run them without problem. As a plus, both of them will give way better thumbnails than GD.

Tom

httpwebwitch

3:53 pm on Apr 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might not like this idea because it's not PHP-automated, but PhotoShop has a nice "batch" feature, you record an "action" to perform and apply that action to a batch... PS will go through all your files, resize and resave them with a prefixed name. I used it recently to resize a collection of thousands of images from a product catalog.

I know you'd like the files to be thumbnailed to help them download faster, but in some cases it's OK to resize images by setting their HTML width and height attributes. Get the image's actual size with getimagesize(), find the aspect ratio and reduce it to the desired size in integers. The image is still huge and slow, but it shows up OK and as long as the page isn't full of them, one slow-loading image is usually forgivable.

There is another weird option: Create a Flash movie that loads the image dynamically, and displays it within a MovieClip, then set the _width and _height attributes of the MovieClip to fit the stage. Advantages: the Flash movie loads right away (doesn't hold up the rest of the page), the large image file streams in (it will show up when it's done), and it's also more difficult for people to save the image (if that's a priority for you)

Good luck!

isitreal

4:21 pm on Apr 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Going along with the photoshop suggestion, there is a great little program called Thotor, it's shareware now, used to be free, that does really good thumbnails, smaller file sizes than photoshop from what I've seen, does batch jobs more or less, takes only a few seconds to generate a gallery of thumbnails.

Numberman

5:21 pm on Apr 30, 2004 (gmt 0)

10+ Year Member



There are simple console image manipulation programs available on the internet; try and find one for Linux. If you can, it could also be possible to use the exec() command to resize them.