[06-Mar-2005 17:50:41] PHP Warning: imagecreatefromjpeg(): 'uploads/sassy_stacy/1110149441.jpg' is not a valid JPEG file in /home/scottttt/public_html/createthumb.inc.php on line 6
However, when the picture is viewed fullsize, it shows up fine. What could the problem be?
Here is my thumbnail code:
Code: Select all
<?
function createthumb($name,$filename,$new_w,$new_h){
global $gd2;
$system=explode(".",$name);
if (preg_match("/jpg|jpeg|JPG|JPEG|Jpg|JpG|jPG|JPg|JPEg|JPeg|Jpeg|jPEG|jpEG|jPeG|JpEg|JPEg|JpeG|jpEg|jpeG/",$systemї1])){
$src_img=imagecreatefromjpeg($name);
}
if (preg_match("/png|PNG|pNg|Png|pNG|PnG/",$systemї1])){
$src_img=imagecreatefrompng($name);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=imagecreatetruecolor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/png|PNG|pNg|Png|pNG|PnG/",$systemї1])){
imagepng($dst_img,$filename);
} else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
?>