Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #795: Compare original vs optimized image isnot working probably #814

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1445,11 +1445,6 @@ ul.imagify-datas-details.imagify-datas-details {
}

/* Attachments specifics */
.wp_attachment_image #imagify-visual-comparison .close-btn,
.imagify-visual-comparison .close-btn {
top: 0;
}

.wp_attachment_image #imagify-visual-comparison .imagify-modal-content,
.imagify-visual-comparison .imagify-modal-content {
padding-top: 40px;
Expand Down Expand Up @@ -1585,3 +1580,11 @@ ul.imagify-datas-details.imagify-datas-details {
.imagify-upsell .imagify-meteo-icon {
filter: invert(100%) sepia(100%) saturate(0%) hue-rotate(104deg) brightness(103%) contrast(103%);
}

.imagify-original-fize-size {
display: block !important;
}

.imagify-original-fize-size .value {
padding-left: 15px !important;
}
2 changes: 1 addition & 1 deletion assets/css/admin.min.css

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions assets/js/jquery.twentytwenty.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
modalHtml += '<img class="imagify-img-after" alt="" width="' + settings.width + '" height="' + settings.height + '">';
modalHtml += '</div>';
modalHtml += '<div class="imagify-comparison-levels">';
modalHtml += '<div class="imagify-c-level imagify-level-original go-left">';
modalHtml += '<div class="imagify-c-level imagify-level-original go-left imagify-original-fize-size">';
modalHtml += '<p class="imagify-c-level-row">';
modalHtml += '<span class="label">' + imagifyTTT.labels.filesize + '</span>';
modalHtml += '<span class="value level">' + settings.originalSize + '</span>';
Expand Down Expand Up @@ -515,7 +515,7 @@
// If shown image > 360, use twentytwenty.
if ( imagifyTTT.imageWidth > imagifyTTT.widthLimit && oriSource.src ) {

filesize = $( '.misc-pub-filesize strong' ).text();
filesize = $( '#imagify-full-optimized-size' ).val();
saving = $( '.imagify-data-item .imagify-chart-value' ).text();

// Create button to trigger.
Expand Down Expand Up @@ -574,7 +574,7 @@
originalUrl: $this.data( 'backup-src' ),
optimizedUrl: $this.data( 'full-src' ),
originalSize: $datas.find( '.original' ).text(),
optimizedSize: $datas.find( '.imagify-data-item .big' ).text(),
optimizedSize: $datas.find( '#imagify_data_sum .big' ).text(),
saving: $datas.find( '.imagify-chart-value' ).text(),
modalAppendTo: $this.closest( '.column-primary' ),
trigger: $this,
Expand Down Expand Up @@ -630,7 +630,7 @@
originalUrl: originalSrc,
optimizedUrl: $( '#imagify-full-src' ).val(),
originalSize: $( '#imagify-original-size' ).val(),
optimizedSize: $datas.find( '.imagify-data-item .big' ).text(),
optimizedSize: $datas.find( '#imagify_data_sum .big' ).text(),
saving: $datas.find( '.imagify-chart-value' ).text(),
modalAppendTo: $( '.media-frame-content .thumbnail-image' ),
trigger: $( '#imagify-media-frame-comparison-btn' ),
Expand Down
2 changes: 1 addition & 1 deletion assets/js/jquery.twentytwenty.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion inc/admin/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ function _imagify_attachment_submitbox_misc_actions() {
if ( $media->has_backup() && $data->is_optimized() ) {
?>
<input id="imagify-full-original" type="hidden" value="<?php echo esc_url( $media->get_backup_url() ); ?>">
<input id="imagify-full-original-size" type="hidden" value="<?php echo esc_attr( $data->get_original_size( true, 0 ) ); ?>">
<input id="imagify-full-original-size" type="hidden" value="<?php echo esc_attr( $data->get_original_size() ); ?>">
<input id="imagify-full-optimized-size" type="hidden" value="<?php echo esc_attr( $data->get_optimized_size() ); ?>">
<?php
}
}
2 changes: 1 addition & 1 deletion inc/functions/admin-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function get_imagify_attachment_optimization_text( $process ) {

$is_media_page = Imagify_Views::get_instance()->is_media_page();
$is_library_page = Imagify_Views::get_instance()->is_wp_library_page();
$output = $is_media_page ? '' : '<ul class="imagify-datas-list">';
$output = $is_media_page ? '' : '<ul class="imagify-datas-list" id="imagify_data_sum">';
$output_before = $is_media_page ? '' : '<li class="imagify-data-item">';
$output_after = $is_media_page ? '<br/>' : '</li>';
$reoptimize_link = get_imagify_attachment_reoptimize_link( $process );
Expand Down
Loading