just thought probably i need to post it in...
i snatched this script from the web, probably from this site, i can't really remember. i tried many different scripts, and i didn't know where i'm making the mistake.
the script below is just to test one picture in the directory, to see if it works.
i'm sure the scripts i've seen on the web (including this) are supposed to work, i believe the error is from my part, i just don't know what it is.
the directory is correct, cos i can read from the directory and it's giving me the right file. my gd library is ver2 or higher. i think it's loaded up, because it managed to display a white blank box with a small cross icon inside (sign of no pictures...)
thanks,
daniel
<?php
$picture_location = "images/banner1.jpg";
$size=400; // size in pixel u want the picture to come out
$im_size = GetImageSize ($picture_location);
$imageWidth = $im_size[0];
$imageHeight = $im_size[1];
$im2 = ImageCreateFromJPEG($picture_location);
if ($imageWidth>=$imageHeight)
{
$width=$size;
$height = ($width/$imageWidth)*$imageHeight;
}
else
{
$height=$size;
$width = ($height/$imageHeight)*$imageWidth;
}
$im = imageCreateTrueColor( $width, $height );
ImageCopyResized ($im,$im2, 0, 0, 0, 0, $width, $height, imageWidth, $imageHeight);
Header("Content-type: image/jpeg");
Imagejpeg($im,'',100);
ImageDestroy($im);
ImageDestroy ($im2);
?>