• It doesn’t work anymore. Even it doesn’t save its settings. It used to work. Maybe it doesn’t support the current PHP/WP version.

    My WP version: 6.7.1
    My PHP version: 8.4.2

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi! @abdolaziz

    @ilmdesigns

    Today when I tried to save the settings of this plugin on a new project, I encountered the same problem. I read the reviews and realized that the problem was not mine.
    I started to analyze and realized that an error was happening: Nonce verification failed.

    So, something with nonce

    I checked the file /admin/js/square-thumbnails-admin.js and realized that this nonce is simply not passed there, so the settings are not saved

    I suggest the following solution to the problem – add a line to the provided JS file:

    sqt_nonce:  $('#sqt_nonce').val(),

    This worked for me, the settings started to save. The final file looks like this:

    (function( $ ) {
    'use strict';

    /**
    * All of the code for your admin-facing JavaScript source
    * should reside in this file.
    *
    * Note: It has been assumed you will write jQuery code here, so the
    * $ function reference has been prepared for usage within the scope
    * of this function.
    *
    * This enables you to define handlers, for when the DOM is ready:
    *
    * $(function() {
    *
    * });
    *
    * When the window is loaded:
    *
    * $( window ).load(function() {
    *
    * });
    *
    * ...and/or other possibilities.
    *
    * Ideally, it is not considered best practise to attach more than a
    * single DOM-ready or window-load handler for a particular page.
    * Although scripts in the WordPress core, Plugins and Themes may be
    * practising this, we should strive to set a better example in our own work.
    */
    $(function() {
    $('#sqt-save-settings').on('click',function (){
    var data = {
    action: 'sqt_settings',
    sqt_nonce: $('#sqt_nonce').val(),
    halign: $('#sqt_halign').val(),
    valign: $('#sqt_valign').val(),
    bgcolor: $('#sqt_bgcolor').val(),
    getimcolor: ($('#sqt_getimcolor').is(':checked')?1:0),
    dofill: ($('#sqt_dofill').is(':checked')?1:0),
    tooriginal: ($('#sqt_tooriginal').is(':checked')?1:0),
    addallsizes: ($('#sqt_addallsizes').is(':checked')?1:0),
    };

    $.post( ajaxurl, data, function(response) {
    alert('The settings were saved!');
    });
    });
    });


    $(function() {
    $('#sqt_bgcolor').wpColorPicker();
    });


    })( jQuery );

    @ilmdesigns, please make changes to the plugin if you think my solution works.

    Thank you and have a nice day!

    Thread Starter Abdolaziz

    (@abdolaziz)

    Hello

    I followed the instruction and worked for me. Unfortunately it seems the developer abandoned and forgot the the plugin. It’s better you fork it and make the updated version of this awesome and handy plugin.

    Plugin Author nicunarcisbodea

    (@nicunarcisbodea)

    Thank you for the fix! I will update today.

    Thread Starter Abdolaziz

    (@abdolaziz)

    If you want to update your plugin after 5 months, you should support the AVIF format as it currently doesn’t support it. Also, if you think of adding new features, you can update all together.

    I’m currently searching for a plugin to do the same and also remove the background as well which your plugin doesn’t do that.

    Plugin Author nicunarcisbodea

    (@nicunarcisbodea)

    Done! Updated with everything you said and more.

    Thread Starter Abdolaziz

    (@abdolaziz)

    Hello

    Thanks for your updates. I hope you continue working on it and even offer the pro version with more options and a decent price tag. I’ll buy it if you offer these features. The options you promised on the pro version ad are awesome.
    I hope you don’t force users to use a cloud service for image processing in the pro version, especially for BG removal. The steps of image processing should be decided by you and you know more than us which process should be first, second,…

    1. The background removal doesn’t work at all. I tested on AVIF and JPG. Manually and automatically.
    2. Converting images manually or automatically upon uploading to modern image formats like AVIF and WEBP.
    3. Please provide me with your email so I can give my staging site credentials so you can check everything from the backend and even send you the images I tested on.
    4. Adding the option to restrict users not to upload image above the specific image size. For this function I use another code snippet that makes uploaded images to a maximum size I specify. I hope you add this option via UI. This is the code:
      “add_filter( ‘wp_handle_upload’, function ( $file ) {
    5. $max_width = 1000;
    6. $max_height = 1000;
    7. // Check if the file is an image.
    8. $mime_type = mime_content_type( $file[‘file’] );
    9. if ( strpos( $mime_type, ‘image’ ) === false ) {
    10. return $file;
    11. }
    12. // Get the image size.
    13. $image_size = getimagesize( $file[‘file’] );
    14. if ( ! $image_size ) {
    15. return $file;
    16. }
    17. // Check if the image is smaller than 1000px width or height.
    18. if ( $image_size[0] <= $max_width && $image_size[1] <= $max_height ) {
    19. return $file;
    20. }
    21. // Resize the image.
    22. $image_editor = wp_get_image_editor( $file[‘file’] );
    23. if ( is_wp_error( $image_editor ) ) {
    24. return $file;
    25. }
    26. $image_editor->resize( $max_width, $max_height );
    27. $image_editor->save( $file[‘file’] );
    28. return $file;
    29. } );
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this review.