I'm in the process of converting images from external websites references to images stored in my amazon S3 account. I'm running a script to do the conversion for the images I need, however the script continues to break with this error message: E_WARNING: imagecreatefromjpeg(http://www.site.org/Ansichtskarten.images/I/AK04659a.jpg): failed to open stream: Connection timed out Is there anyway I can have the script just continue running even if there is an error? Restarting the script is frustrating and 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 * FROM city_images WHERE city_id > 0 ORDER BY 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 INTO `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;
?>