• Resolved certainlyakey

    (@certainlyakey)


    Hi! Thanks for the great plugin.

    I’d like to integrate it with a retina plugin to produce retina images on each crop. The idea is to generate retina thumbnails after an image has been cropped with Crop-Thumbnails (here’s a topic regarding that). However, if I do something like this:

    function functionName( $fullFilePath, $imageSizeName, $imageMetadata ) {
      // wr2x_generate_images( $imageMetadata );
    }
    
    add_action( 'crop_thumbnails_after_save_new_thumb', 'functionName' );

    after cropping of any size of any image an alert appears saying that the plugin can’t connect to the server. This happens even if the action contents is empty.

    Am I using the action correctly?

    Thanks a lot!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    If an alert appears inspect the browser network result with the developer console. Depending on your wordpress debug settings there will be an error message in the response of the crop-request (frontend).

    Thread Starter certainlyakey

    (@certainlyakey)

    Hmm, statusText says 500 Internal Server Error. My WP_DEBUG is true. But am I using the hook in a right way?

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Dont know – depends on if you have this function already defined. I would recommend add this in this way:

    
    add_action( 'crop_thumbnails_after_save_new_thumb', function($fullFilePath, $imageSizeName, $imageMetadata)) {
        //do something
    });
    
    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @vovastik Why did you report this topic?

    Sorry to bother you. I pressed the wrong button.
    I wanted to unsubscribe, but I don’t know how to do that.

    Thread Starter certainlyakey

    (@certainlyakey)

    @volkmar-kantor even if i use the action with an anonymous function, I still get The plugin can not correctly connect to the server. error after pressing crop.
    This happens regardless of whether the function is empty, has some sort of print_r call inside or something else. And I also have 500 Internal Server Error as statusText in console.

    This happens on the same site in two environments (local and hosting environment).

    Is there any explanation for this issue?

    @certainlyakey were you ever able to get this working? I’m running into the same issue with the “plugin cannot connect to server” error. I, like you, am attempting to marry the Crop Thumbnails plugin with the WP Retina 2x plugin (like YoImages used to do).

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    @heidimark i recommend you add a debug log and check if any php errors occurred.

    I often use the following code in the wp-config to do a debug log. Make sure to configure the wp-debug.log path (line 4) in a way that the log file is not accessible from the browser.

    
    define('WP_DEBUG', true);
    define('WP_DEBUG_DISPLAY', false); // Turn forced display OFF
    @ini_set('display_errors', 0);
    define('WP_DEBUG_LOG', __DIR__.'/wp-debug.log');
     

    @volkmar-kantor I’ve got the PHP error figured out. However, the call to wr2x_generate_images is generating the files but not based off of the crop defined. It’s almost as if the metadata isn’t being saved correctly.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to use crop_thumbnails_after_save_new_thumb action’ is closed to new replies.