Clean up and force a rebuild of thumbnails when customising a crop region.
This commit is contained in:
@@ -149,18 +149,19 @@ class EditAsset extends HTMLController
|
||||
$crop_value = $data->crop_width . ',' . $data->crop_height . ',' . $data->source_x . ',' . $data->source_y;
|
||||
$meta[$crop_key] = $crop_value;
|
||||
|
||||
// If we uploaded a custom thumbnail, stop considering it such.
|
||||
// If we previously uploaded a custom thumbnail, stop considering it such.
|
||||
$custom_key = 'custom_' . $data->thumb_width . 'x' . $data->thumb_height;
|
||||
if (isset($meta[$custom_key]))
|
||||
{
|
||||
// TODO: delete from disk
|
||||
unset($meta[$custom_key]);
|
||||
}
|
||||
|
||||
// Save meta changes so far.
|
||||
$image->setMetaData($meta);
|
||||
|
||||
// Force a rebuild of related thumbnails.
|
||||
$thumb_key = 'thumb_' . $data->thumb_width . 'x' . $data->thumb_height;
|
||||
foreach ($meta as $meta_key => $meta_value)
|
||||
if ($meta_key === $thumb_key || strpos($meta_key, $thumb_key . '_') !== false)
|
||||
unset($meta[$meta_key]);
|
||||
|
||||
$image->setMetaData($meta);
|
||||
$image->removeThumbnailsOfSize($data->thumb_width, $data->thumb_height);
|
||||
|
||||
$payload = [
|
||||
'key' => $crop_key,
|
||||
|
||||
Reference in New Issue
Block a user