Originally posted by Mordecai
Define "too big." Like, what filesize?
I'm not 100% sure if it's quality or size (width x height.. if i use photoshop and resize it to about 800x600 it usually works out fine... which also lowers filesize(kb))
and here's my code:
<?php
include("db.php");
$getimage = "SELECT url FROM images WHERE id='$id' ";
$sqlimg = mysql_query($getimage);
while($imagerow = mysql_fetch_array($sqlimg)) {
$filename = $imagerow["url"];
$filen = $_FILES[filename][name];
$filet = $_FILES[filename][type];
$imageInfo = getimagesize($filename);
$new_w = "150";
$new_h = "113";
$img_src ="$filename";
$dst_img=ImageCreateTrueColor($new_w,$new_h);
$src_img=ImageCreateFromJpeg("$filename");
imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,$imageInfo['0'],$imageInfo['1']);
ImageJpeg($dst_img, '', 100);
}
?>
it uses ImageCreateFromTrueColor() then ImageCreateFromJpeg()
and it resmaples it with imagecopyresampled() [same as resizing, better qaulity 🙂 ] and then to dispaly the image it uses ImageJpeg.
Not sure on what the deal is, but thanks for looking 🙂