image processing - Stop imagecreatefromjpeg Error From Being Thrown in PHP -
i'm in process of converting images external websites references images stored in amazon s3 account. i'm running script conversion images need, script continues break error message:
e_warning: imagecreatefromjpeg(http://www.site.org/.../i/ak04659a.jpg): failed open stream: connection timed out
is there anyway can have script continue running if there error? restarting script frustrating , counterproductive.
script:
<?php ini_set('memory_limit','2048m'); ini_set('max_execution_time', 30000000); ini_set("user_agent", 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.8.1.9) gecko/20071025 firefox/2.0.0.9'); ini_set('gd.jpeg_ignore_warning', 1); $cron = true; include('init.inc.php'); $query = 'select * city_images city_id > 0 order city_id'; $city_images = sql::q($query); //var_dump($cities); die; while ($row = sql::f_assoc($city_images)) { //var_dump($row); $city_id = $row['city_id']; $image = image::resize_upload_amazon_new($row['image'], $row['city_id']); if(!is_array($image)){ $sql = "insert `city_images_new` (`city_id`, `image`) values ('{$city_id}', '{$image}')"; sql::q($sql); } //var_dump($image); die; } //die; echo php_eol . "images converted succesfully"; die; ?>
sorry posting, can't make comments until 50 reputation.
i think need insert conditional on transform. i'm supposing ($row['image'] or $row['city_id']) url of image.
if (! $image = image::resize_upload_amazon_new($row['image'], $row['city_id'])) continue;
but can more precesily if show us, method named "resize_upload_amazon_new" "image" object
Comments
Post a Comment