acctman Posted March 8, 2009 Share Posted March 8, 2009 I'm receiving the following two errors. I understand why i'm receiving the errors, (file is no longer available on server). How do I prevent my script from writing an error to the log? PHP Warning: imagecreatefromjpeg(/2005/04/2946/imgExp/imgTmb/2946-101007.jpg) [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /files/pvtexp.php on line 38 PHP Warning: imagejpeg(): supplied argument is not a valid Image resource in /files/pvtexp.php on line 46 header("Content-type: image/jpeg"); if ($_GET['tmb'] == 1) { $im = imagecreatefromjpeg('/'.$date.'/'.$mid.'/'.$type.'/imgTmb/'.$mid.'-'.$iid.'.jpg'); } else { $im = imagecreatefromjpeg('/'.$date.'/'.$mid.'/'.$type.'/'.$mid.'-'.$iid.'.jpg'); } imagejpeg($im); imagedestroy($im); Link to comment https://forums.phpfreaks.com/topic/148442-solved-error-checking-for-imagecreatefromjpeg/ Share on other sites More sharing options...
corbin Posted March 8, 2009 Share Posted March 8, 2009 Check if the file exists first. http://php.net/file_exists Link to comment https://forums.phpfreaks.com/topic/148442-solved-error-checking-for-imagecreatefromjpeg/#findComment-779330 Share on other sites More sharing options...
acctman Posted March 8, 2009 Author Share Posted March 8, 2009 thanks Link to comment https://forums.phpfreaks.com/topic/148442-solved-error-checking-for-imagecreatefromjpeg/#findComment-779385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.