aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-02-05 01:09:53 +0000
committerplegall <plg@piwigo.org>2012-02-05 01:09:53 +0000
commit74fc04163437e1f301dea563a0264e2277893f74 (patch)
treed26947cbbd1c022a0f72097a3daa4b37ae672a6f
parent5e9026e9f52c5c9eb3da337d0af1b92da5345a84 (diff)
feature 2562 added: pre-cache thumbnail at upload time
git-svn-id: http://piwigo.org/svn/trunk@13030 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions_upload.inc.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index bfe972d25..648b8ddc6 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -334,6 +334,24 @@ SELECT
invalidate_user_cache();
+ // cache thumbnail
+ $query = '
+SELECT
+ id,
+ path
+ FROM '.IMAGES_TABLE.'
+ WHERE id = '.$image_id.'
+;';
+ $image_infos = pwg_db_fetch_assoc(pwg_query($query));
+
+ 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));
+ unset_make_full_url();
+
+ fetchRemote($thumb_url, $dest);
+
+
return $image_id;
}