mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-21 06:35:18 +00:00
Merge branch 'dev' of /home/macgirvin/roadhouse into dev
This commit is contained in:
commit
fcb21af30b
1 changed files with 6 additions and 6 deletions
|
@ -33,7 +33,6 @@ class Img_cache {
|
|||
return self::url_to_cache($url,$path);
|
||||
}
|
||||
|
||||
|
||||
static function url_to_cache($url,$file) {
|
||||
|
||||
$fp = fopen($file,'wb');
|
||||
|
@ -48,9 +47,6 @@ class Img_cache {
|
|||
|
||||
fclose($fp);
|
||||
|
||||
// $file *should* exist. The existence check was added because in at least one case
|
||||
// this code was reached and $file did not exist. Go figure...
|
||||
|
||||
if ($x['success'] && file_exists($file)) {
|
||||
$i = @getimagesize($file);
|
||||
if ($i && $i[2]) { // looking for non-zero imagetype
|
||||
|
@ -58,9 +54,13 @@ class Img_cache {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
// Ignore errors - we don't care if it doesn't exist here.
|
||||
@unlink($file);
|
||||
|
||||
// We could not cache the image for some reason. Leave an empty file here
|
||||
// to provide a record of the attempt. We'll use this as a flag to avoid
|
||||
// doing it again repeatedly.
|
||||
|
||||
file_put_contents($file, EMPTY_STR);
|
||||
logger('cache failed ' . $file);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue