pic_name_wex: ολόκληρο το όνομα του αρχείου
pic_name: το όνομα του αρχείου, χωρίς το extension
Ο κώδικας είναι ο εξής:
Κώδικας: Επιλογή όλων
function thumbsCreator($pic_name_wex)
{
connect_db();
$l = explode('.', $pic_name_wex);
$pic_name = $l[0];
$query = "SELECT type FROM afises WHERE name='" . $pic_name_wex . "'";
$result = mysql_query($query);
$type = mysql_fetch_array($result);
if (preg_match('/jpeg/',$type[type]))
$src_img = ImageCreateFromJpeg($pic_name_wex);
elseif (preg_match('/png/',$type[type]))
$src_img = imagecreatefrompng($pic_name_wex);
elseif (preg_match('/bmp/', $type[type]))
$src_img = imagecreatefromwbmp($pic_name_wex);
else
echo "Δεν υπάρχει διαθέσιμο thumbnail.";
$picX = imagesx($src_img);
$picY = imagesy($src_img);
$coef = $picX/200;
$thumbY = ($picY / $coef);
$dst_img = imagecreatetruecolor(200,$thumbY);
imagecopyresampled($dst_img, $srt_img,0,0,0,0,200,$thumbY,$picX, $picY);
if (preg_match('/jpeg/',$type[type]))
imagejpeg($dst_img, $pic_name . "_thumb.jpg");
elseif (preg_match('/png/',$type[type]))
imagepng($dst_img, $pic_name . "_thumb.png");
elseif (preg_match('/bmp/', $type[type]))
imagewbmp($dst_img, $pic_name . "_thumb.bmp");
imagedestroy($dst_img);
imagedestroy($src_img);
}
Κώδικας: Επιλογή όλων
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in ...
Μπορεί κανείς να βοηθήσει?