angst
07-29-2005, 08:33 PM
Hello,
I'm using this script to generate thumb nails, ( width, height )
but it just shows the images, what i would like to do it save the image from the script,
my code:
<?php
header('Content-type: image/jpeg');
$myimage = resizeImage('images/Bikini006.jpg', '120', '80');
function resizeImage($filename, $newwidth, $newheight){
list($width, $height) = getimagesize($filename);
if($width > $height && $newheight < $height){
$newheight = $height / ($width / $newwidth);
} else if ($width < $height && $newwidth < $width) {
$newwidth = $width / ($height / $newheight);
} else {
$newwidth = $width;
$newheight = $height;
}
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
return imagejpeg($thumb);
}
print resizeImage('images/Bikini006.jpg', '120', '80');
?>
so how can i save the modified version to a directory on the server from this script??
thanks in advance for your time!
-Ken
I'm using this script to generate thumb nails, ( width, height )
but it just shows the images, what i would like to do it save the image from the script,
my code:
<?php
header('Content-type: image/jpeg');
$myimage = resizeImage('images/Bikini006.jpg', '120', '80');
function resizeImage($filename, $newwidth, $newheight){
list($width, $height) = getimagesize($filename);
if($width > $height && $newheight < $height){
$newheight = $height / ($width / $newwidth);
} else if ($width < $height && $newwidth < $width) {
$newwidth = $width / ($height / $newheight);
} else {
$newwidth = $width;
$newheight = $height;
}
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
return imagejpeg($thumb);
}
print resizeImage('images/Bikini006.jpg', '120', '80');
?>
so how can i save the modified version to a directory on the server from this script??
thanks in advance for your time!
-Ken