• Resolved n381

    (@n381)


    Hello, thank you for providing such good plugin development.

    i’m having a task of setting uploads to CDN, upon done the file transfer(without thumbnails), i would have to regenerate thumbnail from the original images, that are actually stored within the external server directory, at CDN service.

    Currently, the setup of CDN is fully supporting uploading with also thumbnails on upload generating, via several WP builtin media filters. Now to use your plugin within this specific setup, i’ve read through the advanced filters scripts you’ve posted at GitHub , so my question is, considering the provided snippet :

    // add_filter( ‘regenerate_thumbs_original_image’, ‘my_frt_original_image’ );
    function my_frt_original_image( $original_path ) {
    if ( false !== strpos( $original_path, ‘bad_original’ ) ) {
    return false;
    }
    return $original_path;
    }

    -can i set effectively the remote server location as the $original_path //=’cdn.example.com/’ , considering the already explained fully functioning remote upload transferring ? The $original_path set value would only serve as the source locations of the original unscaled images, while the upload part would be handled by the functions of other, the CDN plugin, do you have any suggestion on attaching event/hook with that other function?

    Thank you for any further information

    • This topic was modified 1 month, 3 weeks ago by n381.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    Hi, that’s a great question! Instead of a CDN URL though, you must provide a local path. So what you can do in that function is download the original image to the local path–would be fine to keep it in the same location. Then use the regenerate_thumbs_post_update action to upload the new thumbs to your CDN and remove the original and thumbs from local storage.

    Now, I’m not 100% sure what the plugin will display for results, as it will attempt to check which thumbs were generated after regenerate_thumbs_post_update, and if you’ve removed them, then that will fail. But the regen process itself should work fine, it just might display something that makes it seem like there were failures. You’ll just need to check manually that the thumbs made it to your CDN.

    Thread Starter n381

    (@n381)

    Hello, thank you for replying,

    after trying the mentioned function and setting $original_path to subdmain url, on running a thumbnail re-generating, i’ve got the errors “The originally uploaded image file cannot be found.”

    I’ve initially thought of a modification, to instruct the actual images path at cdn and have the Force Regenerate Thumbnails plugin to generate images at local server directory, and later the other plugin would handle the transfer to remote cdn server.

    Can you propose how to utilize the filter function and the $original_path in order to make this plugin reach the correct images paths as the absolute urls?

    Thank you, regards

    Plugin Author nosilver4u

    (@nosilver4u)

    FRT needs a (local and absolute) file path, not a URL, as FRT cannot operate on URLs, and you need to download the original from the CDN URL to that local path, all within the function you’ve hooked onto the regenerate_thumbs_original_image filter.

    See this for an example: https://github.com/nosilver4u/ewww-image-optimizer/blob/5dfc9a4f901c0f852ecccc7709207ec15886c7c4/common.php#L7121

    Of course, you don’t need all of that, but it should get you going in the right direction.

    Plugin Support adamewww

    (@adamewww)

    I’m going to resolve this thread, however, if you have further questions, please feel free to open a new one.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.