Skip to content

Commit

Permalink
feature 2562 added: pre-cache thumbnail at upload time
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@13030 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Feb 5, 2012
1 parent 5e9026e commit 74fc041
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions admin/include/functions_upload.inc.php
Expand Up @@ -334,6 +334,24 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie

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;
}

Expand Down

0 comments on commit 74fc041

Please sign in to comment.