Continue url-import even when an error occurs
This commit is contained in:
parent
d0368ea651
commit
5d7328613d
@ -30,25 +30,31 @@ class Import extends Module {
|
|||||||
|
|
||||||
static function url($urls, $albumID = 0) {
|
static function url($urls, $albumID = 0) {
|
||||||
|
|
||||||
|
$error = false;
|
||||||
|
|
||||||
# Parse
|
# Parse
|
||||||
$urls = str_replace(' ', '%20', $urls);
|
$urls = str_replace(' ', '%20', $urls);
|
||||||
$urls = explode(',', $urls);
|
$urls = explode(',', $urls);
|
||||||
|
|
||||||
foreach ($urls as &$url) {
|
foreach ($urls as &$url) {
|
||||||
|
|
||||||
if (@exif_imagetype($url)!==false) {
|
if (@exif_imagetype($url)===false) {
|
||||||
|
$error = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$pathinfo = pathinfo($url);
|
$pathinfo = pathinfo($url);
|
||||||
$filename = $pathinfo['filename'] . '.' . $pathinfo['extension'];
|
$filename = $pathinfo['filename'] . '.' . $pathinfo['extension'];
|
||||||
$tmp_name = LYCHEE_DATA . $filename;
|
$tmp_name = LYCHEE_DATA . $filename;
|
||||||
|
|
||||||
if (!@copy($url, $tmp_name)) return false;
|
if (@copy($url, $tmp_name)===false) $error = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
$import = Import::server($albumID, LYCHEE_DATA);
|
||||||
|
|
||||||
return Import::server($albumID, LYCHEE_DATA);
|
if ($error===false&&$import===true) return true;
|
||||||
|
else return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user