Computing.Net > Forums > Web Development > Resizing image with PHP

Resizing image with PHP

Reply to Message Icon

Original Message
Name: cernov
Date: July 12, 2006 at 17:53:30 Pacific
Subject: Resizing image with PHP
OS: Windows
CPU/Ram: AMD
Comment:

I want to do a list of thumbnails with images. But i don't want to resize all images and send to homepage.

Is there a PHP script that resize the image automatically? I don't want to use "" because it will need to load all the image.

thanks!


Report Offensive Message For Removal


Response Number 1
Name: Michael J (by mjdamato)
Date: July 13, 2006 at 08:07:37 Pacific
Subject: Resizing image with PHP
Reply: (edit)

Be sure to properly modify your code when posting so it isn't processed. Make sure you view the post int he preview page before submitting.

Here is the code you posted:

[SCRIPT LANGUAGE="Javascript"]
if(GetCookie('computingnet_image') == 'yes') {
document.write('');
}
[/SCRIPT]

Not sure I entirely understand your question. Are you wanting 1) the PHP code to display the images at thumbnail size or are you wanting 2) the PHP code to create the thumbnail images?

If you are wanting #1, that is a bad idea since it would take a long time to load the page.

So, if you are meaning #2 I would have to ask are these images that you are uploading or are they user submitted photos.

If you are uploading the photos there are many free desktop applications that can create the thumbnails for you very easily (MS provides the free ImageResizer for XP).

If the users are uploading the images then a PHP solution would make sense. In that case you would need to use some of the image functions in PHP: http://us2.php.net/gd

And/Or you could find a class someone has written to implement onto your site:

http://www.phpclasses.org/browse/package/1450.html

http://www.programmers-corner.com/sourcecode/254

Michael J


Report Offensive Follow Up For Removal

Response Number 2
Name: cernov
Date: July 13, 2006 at 15:47:18 Pacific
Subject: Resizing image with PHP
Reply: (edit)

it's the second option :)

The code was:


Report Offensive Follow Up For Removal

Response Number 3
Name: cernov
Date: July 13, 2006 at 15:48:12 Pacific
Subject: Resizing image with PHP
Reply: (edit)

ahhhhhhhh

The code is:

(img src=image width=xxx height=yyy)



Report Offensive Follow Up For Removal

Response Number 4
Name: Laler
Date: July 15, 2006 at 15:28:54 Pacific
Subject: Resizing image with PHP
Reply: (edit)

So you want: 2) the PHP code to create the thumbnail images?

Other than classes above, this is what I use often: phpThumb

It'll probably take some time to understand, but once you do you can do almost anything, to any images - from user uploads or from remote sites. You can resize, keep proportion, create thumb with zoom&crop, add dropshadows, etc...


Here's one site using it, when the administrator upload a new image, it'll resize it and create a thumb. The thumb is zoomcropped so it all looks the same without forcing the image heights/widths.

---


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Resizing image with PHP

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software