0

Possible Duplicate:
Efficient JPEG Image Resizing in PHP
Non blocking functions PHP

I am creating a system where a user will be able to upload images via a file manager system.

I assume the user to simply upload files directly from their camera so the image will be full size in my filesystem.

I have the images address within my filesystem. ($img = http://www.mysite.com/files/image.jpg)

Is there a way with php to take that address ($img) and before the image is rendered on the page resample and resize the image, ensuring that if there are alot of these images on a single page load speeds won't suffer too much.

Any help is really appreciated.

Community
  • 1
  • 1
  • 3
    http://stackoverflow.com/search?q=resize+php+images – dynamic Jan 17 '12 at 23:56
  • If you don't want speed to suffer, you should reconsider if the "on the fly" approach is really necessary. – mario Jan 17 '12 at 23:57
  • Yes, resizing images with PHP is one of the more popular topics here. Have you tried anything? What specifically is holding you back? The resizing or the on-the-fly part? – deceze Jan 17 '12 at 23:57
  • i dont know what i need to do to resize this image on the fly – user1155083 Jan 18 '12 at 00:01
  • See for example an answer I gave here: [Non blocking functions PHP](http://stackoverflow.com/questions/4955028/non-blocking-functions-php/4955088#4955088) – deceze Jan 18 '12 at 00:06
  • Unless you will need the images in their full resolution later, it would be better to have the file manager resize the image upon upload. – wyqydsyq Jan 18 '12 at 00:21
  • @nomaD Unless you know 100% for sure that you will never need another resolution than the one you're hard coding now, you should always store the original somewhere so you can derive new resizes from it again later. – deceze Jan 18 '12 at 01:07

1 Answers1

0

You would want to use something like phpThumb(), your code would be something like:

$width = 100;
$height = 100;
$img = '/path/to/phpThumb.php?w='.$width.'&h='.$height.'&img='.$img;
wyqydsyq
  • 1,992
  • 1
  • 20
  • 28