Page 1 of 1

Image Resizing/Saving

Posted: Wed Sep 29, 2004 3:28 am
by Steveo31
Got the resize part down, but I'm curious to the script for saving the resized image in a folder that I specify. I have a feeling that it's in the ImageCopyResized or ImageJpeg functions, but I couldn't find anything. What I am doing is having a user upload an image of a product and from there create a thumbnail. Then, save the thumb in a folder as well as the original, or at least a resized of the original (so people dont post 30mb images).

Thanks for any links or whatnot!

Posted: Wed Sep 29, 2004 7:41 am
by timvw
instead of echo'ing it out... just fwrite it to a file ;) and handling file uploads has been explained many times before in this forum

imageJpeg

Posted: Wed Sep 29, 2004 8:21 am
by phpScott
depending on what format you are using to create the smaller image use.
imageJpeg($handel, 'location and name');
manual page
[php_man]imagejpeg[/php_man]
The filename argument is optional, and if left off, the raw image stream will be output directly.
just use the write image(format);

Posted: Wed Sep 29, 2004 1:30 pm
by Steveo31
timvw wrote:instead of echo'ing it out... just fwrite it to a file ;) and handling file uploads has been explained many times before in this forum
I'll give er a try. And... it's not the uploading I'm inquiring about, it's another thing entirely ;)

Thanks for the replies :)

Edit: Little bit of tinkering and came up with this:

Code: Select all

$thumb_ = explode(".", $_FILES['image_path']['name']);
$thumb_name = $thumb_[0];
$thumb_path = "members/".$_SESSION['username']."/".($thumb_name."_thumb.jpg");
ImageJpeg($dst, "$thumb_path", 100);
May be dirty, but works for me :lol:

what I said

Posted: Thu Sep 30, 2004 3:12 am
by phpScott
that's what i said.
the manual is your friend.