Im trying to download images from remote server, resize and then save it local machine.
To do this I use a WideImage.
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'libraries/wideimage/index.php');
include_once($_SERVER['DOCUMENT_ROOT'].'query.php');
do {
wideImage::load($row_getImages['remote'])->resize(360, 206, 'outside')->saveToFile($_SERVER['DOCUMENT_ROOT'].$row_getImages['local']);}
while ($row_getImages = mysql_fetch_assoc($getImages));
?>
This works most of the time. But it has a fatal flaw.
If for some reason one of these images is not available or doesn't exists. Wideimage throws a fatal error. Preventing any further images that may exist from downloading.
I have tried checking file exists like this
do {
if(file_exists($row_getImages['remote'])){
wideImage::load($row_getImages['remote'])->resize(360, 206, 'outside')->saveToFile($_SERVER['DOCUMENT_ROOT'].$row_getImages['local']);}
}
while ($row_getImages = mysql_fetch_assoc($getImages));
But this doesn't work.
What am I doing wrong??
Thanks