• Resolved Azamat Xodjakov

    (@azamat88)


    I’m using the free version. I’ve millions of images. All converter files are in my local server /wp-content/uploads-webpc/uploads/2023/… and everything’s working fine.

    I want to offload my server and move the uploads-webpc folder to a Cloudflare R2 cloud server.

    I’ve experience in creating and customizing plugins. I was just wondering if it’s possible to customize your plugin that way. If you guys have any hooks that I can use to accomplish this task?

    I’d like to do it even if it involves editing the plugin files directly. I’d manage to update it somehow in the future.

    Any help would be much appreciated. Thank you!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @azamat88,

    Thank you for your message.

    Please tell me where are your original files from the /wp-content/uploads/ directory? How is this technically solved?

    Best,
    Mateusz

    Thread Starter Azamat Xodjakov

    (@azamat88)

    Hey @mateuszgbiorczyk,

    Every month I move my source files to Cloudflare R2 server. Right now only the 2024/02 folder is on my local VDS server. As soon as March starts I convert all pictures from February to webp and upload original source files to my R2 cloud server. Files are moved but all attachment records remain in my database.

    For now the uploads-webpc folder files are on my local server. I want to move it to the cloud server as well. What I need is to modify your plugin so that it behaves the same way as though the uploads-webpc folder is in my local server.

    Example:

    My website (WordPress) location: https://index.cy

    Remote original file: https://cdn3.index.cy/wp-content/uploads/2024/01/PLOT-3.jpg

    Remote converted file (not functional for now): https://cdn3.index.cy/wp-content/uploads-webpc/uploads/2024/01/027d3fbf5b52ca4c09d53c7e05028698-2.jpeg.webp

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Thank you for your answer @azamat88,

    Please tell me how you change the URLs to the images?

    Thread Starter Azamat Xodjakov

    (@azamat88)

    @mateuszgbiorczyk, thank you for your replies!

    I’m altering image URLs using wp_get_attachment_url, wp_calculate_image_srcset and wp_get_attachment_image_attributes filters. All three filters use the same function that just replaces the beginning of the URL until uploads folder like this:

    function replace_with_cdn_url( $url ) {
    	$uploads = wp_upload_dir();
    	return str_replace( trailingslashit( $uploads['baseurl'] ), 'https://cdn3.index.cy/wp-content/uploads/', $url );
    }
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @azamat88 I understand. I think that in this situation what you want to do will not be possible. The plugin does not change URLs to images, so when looking at the source of the website, you will see the URLs for the default images all the time. The plugin creates redirections to output files in WebP and AVIF format, changing the MIME type of these images, but without changing the URL.

    Thread Starter Azamat Xodjakov

    (@azamat88)

    @mateuszgbiorczyk,

    Got it – changing source URLs won’t work.

    But can you tell me where exactly is your plugin “redirecting” the file from original to converted? It’s gotta be referencing the converted .webp files somewhere to redirect. Can I somehow change that source destination to my cloud server?

    Please, help me to change the way your plugin reaches to converted pictures.

    I’m using NGINX for the server, in case it makes any difference.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @azamat88 Here you will find information about configuration for the Nginx server:
    https://mattplugins.com/docs/nginx-configuration

    There are no other redirects at the HTML level. In the case of the Apache server, the .htaccess file in the /wp-content directory is responsible for this, while in the case of the Nginx server, we have rules in the host configuration.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Is it possible to move converted files to cloud?’ is closed to new replies.