Skip to content
Permalink
Browse files

fixes #979 derivative cache generation works even for file with repre…

…sentative picture

Cache medium size, instead of thumbnail.
  • Loading branch information...
plegall committed Mar 8, 2019
1 parent a4187ca commit 9f6e3e9080436eec7dc306a36a1e551e4f4cd3b0
Showing with 7 additions and 4 deletions.
  1. +7 −4 admin/include/functions_upload.inc.php
@@ -391,23 +391,26 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
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;
}

0 comments on commit 9f6e3e9

Please sign in to comment.
You can’t perform that action at this time.