Skip to content

Commit

Permalink
Multisize
Browse files Browse the repository at this point in the history
Bug fixed if $conf['derivative_url_style'] != 0
Create a pwg_ajax_thumbnails_loader function

git-svn-id: http://piwigo.org/svn/trunk@13452 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
patdenice committed Mar 1, 2012
1 parent d53c5e4 commit 54ce78c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions include/derivative.inc.php
Expand Up @@ -99,7 +99,7 @@ final class DerivativeImage
public $src_image;

private $params;
private $rel_path, $rel_url, $is_cached;
private $rel_path, $rel_url, $is_cached=true;

function __construct($type, $src_image)
{
Expand Down Expand Up @@ -160,7 +160,6 @@ private static function build($src, &$params, &$rel_path, &$rel_url, &$is_cached
// todo - what if we have a watermark maybe return a smaller size?
$params = null;
$rel_path = $rel_url = $src->rel_path;
$is_cached = true;
return;
}

Expand Down Expand Up @@ -197,7 +196,6 @@ private static function build($src, &$params, &$rel_path, &$rel_url, &$is_cached
}
else
{
$is_cached = true;
$url_style = 1;
}
}
Expand Down
13 changes: 7 additions & 6 deletions themes/default/js/thumbnails.loader.js
Expand Up @@ -21,9 +21,10 @@ function add_thumbnail_to_queue(img, loop) {
});
}

jQuery('img').each(function() {
var img = jQuery(this);
if (typeof img.data('src') != 'undefined') {
add_thumbnail_to_queue(img, 0);
}
});
function pwg_ajax_thumbnails_loader() {
jQuery('img[data-src]').each(function() {
add_thumbnail_to_queue(jQuery(this), 0);
});
}

jQuery(document).ready(pwg_ajax_thumbnails_loader);
4 changes: 2 additions & 2 deletions themes/default/template/thumbnails.tpl
@@ -1,6 +1,6 @@
{if !empty($thumbnails)}{strip}
{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='async'}
{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='async'}
{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
{*define_derivative name='derivative_params' width=160 height=90 crop=true*}
{html_style}
{*Set some sizes according to maximum thumbnail width and height*}
Expand Down

0 comments on commit 54ce78c

Please sign in to comment.