...

View Full Version : How to resize images automatically



jennypretty
11-07-2007, 07:20 PM
Hello,

I have a dating site. When members upload their images, how do I resize the images to be 300px width and let the height automatically?

some images are large so they load too slow.

Can you please help?

Thanks,

Jenny.

p.s.

Here is the upload image code block:

<input name = "image_<? echo $i;?>" type = "text" id="image_<? echo $i;?>" value="<? echo $image[$i];?>" size="20" readOnly >
<input type=BUTTON name=btn_name<? echo $i;?> value="Upload" onClick=attachment('image_<? echo $i;?>')>

Fumigator
11-07-2007, 07:56 PM
Look into the GD library, specifically imagecopyresampled() (http://us2.php.net/manual/en/function.imagecopyresampled.php).

jennypretty
11-08-2007, 03:06 PM
Thank you, I'll try that.

timgolding
11-08-2007, 03:21 PM
Try this..

http://www.codingforums.com/showthread.php?t=126331&highlight=resize

jennypretty
11-08-2007, 05:32 PM
Thanks.

timgolding
11-08-2007, 05:48 PM
did it work?

jennypretty
11-08-2007, 07:27 PM
I tried to create a file called "resizeimg.php" and put your code in.
Then, I put this:
<?PHP
$dimensions_of_thumb=get_dims('http://domain/imagefolder/,200px);
$x_dimension=$dimensions_of_thumb[0];
$y_dimension=$dimensions_of_thumb[1];
?>

on the top of the file that member upload images when they register, but nothing happened. I only change to imagefolder/ because I want to resize all images in that folder, but it does not execute.

I placed on the top of this page:
<input name = "image_<? echo $i;?>" type = "text" id="image_<? echo $i;?>" value="<? echo $image[$i];?>" size="20" readOnly >
<input type=BUTTON name=btn_name<? echo $i;?> value="Upload" onClick=attachment('image_<? echo $i;?>')

Please advice.
Thanks.

timgolding
11-13-2007, 10:17 AM
Sorry for the late response.

I'm a bit confused as to exactly what you have done. Any chance I can see all the code?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum