Commit 2649d295 authored by Nigel McNie's avatar Nigel McNie

Make sure that if an image has been deleted, cached versions of it cannot be served. As per #1659.

This works because delete_image removes the original from disk. The main part of #1659 is actually how to clean up the old cached images. That is not dealt with by this patch.
parent 57a227d7
......@@ -355,14 +355,17 @@ function get_dataroot_image_path($path, $id, $size=null) {
// Work out the location of the original image
$originalimage = $imagepath . '/originals/' . ($id % 256) . "/$id";
if (!$size) {
// No size has been asked for. Check for the original and return that
if (is_readable($originalimage)) {
return $originalimage;
}
// Oops - no original available
// If the original has been deleted, then don't show any image, even a cached one.
// delete_image only deletes the original, not any cached ones, so we have
// to make sure the original is still around
if (!is_readable($originalimage)) {
return false;
}
if (!$size) {
// No size has been asked for. Return the original
return $originalimage;
}
else {
// Check if the image is available in the size requested
$sizestr = serialize($size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment