Skip to content

Commit 74fc041

Browse files
committed
feature 2562 added: pre-cache thumbnail at upload time
git-svn-id: http://piwigo.org/svn/trunk@13030 68402e56-0260-453c-a942-63ccdbb3a9ee
1 parent 5e9026e commit 74fc041

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: admin/include/functions_upload.inc.php

+18
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,24 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
334334

335335
invalidate_user_cache();
336336

337+
// cache thumbnail
338+
$query = '
339+
SELECT
340+
id,
341+
path
342+
FROM '.IMAGES_TABLE.'
343+
WHERE id = '.$image_id.'
344+
;';
345+
$image_infos = pwg_db_fetch_assoc(pwg_query($query));
346+
347+
set_make_full_url();
348+
// in case we are on uploadify.php, we have to replace the false path
349+
$thumb_url = preg_replace('#admin/include/i#', 'i', DerivativeImage::thumb_url($image_infos));
350+
unset_make_full_url();
351+
352+
fetchRemote($thumb_url, $dest);
353+
354+
337355
return $image_id;
338356
}
339357

0 commit comments

Comments
 (0)