WordPress.org

Ready to get started?Download WordPress

Forums

CDN Sync Tool
CDN Sync Tool misses resized copies of original images (6 posts)

  1. rkalla
    Member
    Posted 3 years ago #

    WordPress 3.0.5, CDN Sync Tool 1.8, AWS S3/Cloudfront

    After trying and failing miserably with W3TC's CDN sync functionality, I installed CDN Sync Tool and began a sync operation.

    It caught thousands of files that W3TC missed but there were still a lot of missing images once the operation was done (I re-ran it twice to make sure).

    I ended up using the Manual Dir Sync feature (Thanks for providing that) and manually specifying the wp-content/uploads dir, which ran for many more hours and uploaded thousands of more images.

    After that finished the site was no longer showing broken image links everywhere. Upon closer investigation it looks like CDN Sync Tool (and W3TC) were missing all the resized versions of original images that WordPress creates when you add a big image to a post.

    Things like:
    car-150x150.jpg
    car-480x600.jpg

    ... the resized versions of the original, say car.jpg.

    I need a tool that *literally* mirrors a directory and it's contents and doesn't look at the WordPress Media Library for knowledge of the files. My site is 5 years old and many of the images prior to Media Library are not in it or listed correctly and even many of the newer posts don't have the resized versions added correctly to the ML by WordPress.

    Will CDN Sync Tool work for me in this case or will I just be chasing broken links for resized images in all future posts?

  2. Backie
    Member
    Plugin Contributor

    Posted 3 years ago #

    Well currently it does upload all new resized images as far as I know. I dunno if you're creating these images via the image editor. If you are then it doesn't but since I am not aware of that slight hole in the uploading I'll patch it either tomorrow or Friday. If not then I'll figure out what I've missed and look into patching it up either tomorrow or Friday.

  3. rkalla
    Member
    Posted 3 years ago #

    Backie,

    I appreciate the reply. I really need a tool that sees the raw contents of the /uploads dir and syncs it and doesn't exclusively rely on the media library inside of WP.

    From what I can tell the inclusion of scaled instances of images (e.g. car-150x150.jpg for small and car-500x500.jpg for large) that WP makes during it's "crunching" phase are all ignored.

    I am also using "Add Linked Images to Gallery" plugin which makes the lives of my other writers easier as it pulls in externally linked images directly into the media library on-post and automatically adjusts all img src="" links to point at the local copies.

    I don't know if CDN Sync Tool would run late enough in the post-chain to catch these linked images and sync them; from what I saw during testing today the answer is "no" and I ended up with stories that have more than half the image links broken.

    I'll be the first to admit this is sort of a "worst case" scenario for a CDN Syncing Tool, but I'm hoping the additional details will help you in it's development.

  4. Backie
    Member
    Plugin Contributor

    Posted 3 years ago #

    Well the thing with new uploads is, that the CDN Sync Tool gets the data when it's uploading and WordPress says what the thumbnail sizes are and then it uploads those files so it's actually uploading before it even hits the media library and is using the data that is about to be inserted to the media library. If you're saying this is failing both on upload and in inserting the thumbnails into the media library then I suspect there is another plugin or theme messing with stuff. I've looked at the Add Linked Images to Gallery plugin code and can confirm it's not that. Can you tell me what other plugins you are using?

    It would be possible to do a quick fail safe post edit hook to check and make sure everything is uploaded. However it's not really desirable.

  5. rkalla
    Member
    Posted 3 years ago #

    Backie,

    So CST hooks into the "Add an Image" dialog and watches only the uploads or also the crunched files as well?

    I am not familiar with the internals of Add Linked Images plugin, but does that use the same mechanism?

    So is the manual sync I performed using the side-bar in CST the correct way to mirror my entire library (probably 30k images) to S3?

  6. Backie
    Member
    Plugin Contributor

    Posted 3 years ago #

    Yea when you upload an image using the media library there is a hook where you can filter the meta data. I use this hook to get locations of the images. If the thumbnail array is present then it processes that. I suspect another plugin is messing with the meta data. If you change the

    add_filter("wp_generate_attachment_metadata", array($this, "uploadMedia" )) &&

    on line 35 of lib/Cst/Plugin/Admin.php to

    add_filter("wp_generate_attachment_metadata", array($this, "uploadMedia"), 1) &&

    This may solve the issue, if it does then it's definitely another plugin causing the issue.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic