SAAS: Show logo is deleted on disk when a show instance is deleted
* Default to returning the station logo in response if we can't find the show logo on disk (but it's in our DB).
This commit is contained in:
parent
1f319f84a4
commit
c77749a096
|
@ -416,17 +416,26 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $show->getDbImagePath();
|
$path = $show->getDbImagePath();
|
||||||
|
try {
|
||||||
$mime_type = mime_content_type($path);
|
$mime_type = mime_content_type($path);
|
||||||
if (empty($path)) {
|
if (empty($path)) {
|
||||||
throw new ZendActionHttpException($this, 400, "ERROR: Show does not have an associated image.");
|
throw new ZendActionHttpException($this, 400, "ERROR: Show does not have an associated image.");
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
//To avoid broken images on your site, we return the station logo if we can't find the show logo.
|
||||||
|
$this->_redirect('api/station-logo');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Sometimes end users may be looking at stale data - if an image is removed
|
// Sometimes end users may be looking at stale data - if an image is removed
|
||||||
// but has been cached in a client's browser this will throw an exception
|
// but has been cached in a client's browser this will throw an exception
|
||||||
Application_Common_FileIO::smartReadFile($path, filesize($path), $mime_type);
|
Application_Common_FileIO::smartReadFile($path, filesize($path), $mime_type);
|
||||||
} catch(FileNotFoundException $e) {
|
} catch(FileNotFoundException $e) {
|
||||||
throw new ZendActionHttpException($this, 404, "ERROR: No image found at $path");
|
//throw new ZendActionHttpException($this, 404, "ERROR: No image found at $path");
|
||||||
|
$this->_redirect('api/station-logo');
|
||||||
|
return;
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
throw new ZendActionHttpException($this, 500, "ERROR: " . $e->getMessage());
|
throw new ZendActionHttpException($this, 500, "ERROR: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue