Skip to content

Commit

Permalink
Image upload error handling (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksenator authored and andig committed Dec 26, 2018
1 parent 8434a99 commit 0d42c55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ function uploadImages(array $vcards, $config)
$vcard->uid
);
ob_start();
imagejpeg($imgFile, NULL);
imagejpeg($imgFile, null);
$contents = ob_get_clean();
if (file_put_contents($ftp_destination, $contents, 0, $context) !== false) {
if (@file_put_contents($ftp_destination, $contents, 0, $context) !== false) {
$i++;
}
else {
unset($vcard->rawPhoto); // no wrong link will set in phonebook
error_log(sprintf("ftp access denied for %s.jpg to %s!", $vcard->uid, $config['fonpix']));
}
imagedestroy($imgFile);
}
}
Expand Down

0 comments on commit 0d42c55

Please sign in to comment.