From 9f6e3e9080436eec7dc306a36a1e551e4f4cd3b0 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 8 Mar 2019 15:15:04 +0100 Subject: [PATCH] fixes #979 derivative cache generation works even for file with representative picture Cache medium size, instead of thumbnail. --- admin/include/functions_upload.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php index cedebd14c..ba6bb2bd6 100644 --- a/admin/include/functions_upload.inc.php +++ b/admin/include/functions_upload.inc.php @@ -391,23 +391,26 @@ SELECT invalidate_user_cache(); - // cache thumbnail + // cache a derivative $query = ' SELECT id, - path + path, + representative_ext FROM '.IMAGES_TABLE.' WHERE id = '.$image_id.' ;'; $image_infos = pwg_db_fetch_assoc(pwg_query($query)); + $src_image = new SrcImage($image_infos); set_make_full_url(); // in case we are on uploadify.php, we have to replace the false path - $thumb_url = preg_replace('#admin/include/i#', 'i', DerivativeImage::thumb_url($image_infos)); + $derivative_url = preg_replace('#admin/include/i#', 'i', DerivativeImage::url(IMG_MEDIUM, $src_image)); unset_make_full_url(); - fetchRemote($thumb_url, $dest); + $logger->info(__FUNCTION__.' : force cache generation, derivative_url = '.$derivative_url); + fetchRemote($derivative_url, $dest); return $image_id; }