sub action_ajax_get_thumbnail {
my ($self) = @_;
- my $file = SL::File->get(id => $::form->{file_id});
+ my $id = $::form->{file_id};
+ my $version = $::form->{file_version};
+ my $file = SL::File->get(id => $id);
+
+ $file->version($version) if $version;
+
my $thumbnail = _create_thumbnail($file, $::form->{size});
- my $overlay_selector = '#enlarged_thumb_' . $::form->{file_id};
+ my $overlay_selector = '#enlarged_thumb_' . $id;
+ $overlay_selector .= '_' . $version if $version;
$self->js
->attr($overlay_selector, 'src', 'data:' . $thumbnail->{thumbnail_img_content_type} . ';base64,' . MIME::Base64::encode_base64($thumbnail->{thumbnail_img_content}))
->data($overlay_selector, 'is-overlay-loaded', '1')
ns.add_enlarged_thumbnail = function(e) {
var file_id = $(e.target).data('file-id');
+ var file_version = $(e.target).data('file-version');
var overlay_img_id = 'enlarged_thumb_' + file_id;
+ if (file_version) { overlay_img_id = overlay_img_id + '_' + file_version };
var overlay_img = $('#' + overlay_img_id);
if (overlay_img.data('is-overlay-shown') == 1) return;
var data = {
action: 'File/ajax_get_thumbnail',
file_id: file_id,
- file_version: $(e.target).data('file-version'),
+ file_version: file_version,
size: 512
};
data-file-id="[% file.id %]" data-file-version="[% file.version %]"
src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]"
alt="[% file.file_name %]">
- <img id="enlarged_thumb_[% file.id %]" class="overlay_img">
+ <img id="enlarged_thumb_[% file.id %][% IF file.version %]_[% file.version %][% END %]" class="overlay_img">
</div>
[%- ELSE %]
-