App for Cloudflare® Pro

App for Cloudflare® Pro 1.8.6

Migrate existing media R2

Carlos

New member
Hello,

I can't get the migration to work; it just stuck there. I don't have the option to migrate one by one.

1721503295353.png

Here is a picture not uploaded yet to R2

1721503391064.png
1721503419239.png

Theres no option to move each one.

I have a total of 338 images only 23 move.
 
The option to manually move to/from R2 is under the Edit more details link.

Normally for the moving in bulk, it will only not move something if there's an underlying issue with the media itself (for example the files that are expected to be in the local filesystem for movement can't be found... can't move something that doesn't exist).

With "only" 23 to move, maybe you will run across a specific one that isn't able to be moved and I can help figure out what's going on with that one.
 
Images are there and clickable most of my images are png file, As you can see in the below picture, both images are the same, including same extension, the same size, and just different name. only one uploaded; the other one didn't.


1721503962937.png
 
If you move one manually does it also not move? Even if the primary image is there, WordPress stores a bunch of size variations and keeps track of those variations internally, so if that list of variations that WordPress internally keeps isn't matching up with the files in the filesystem (like some are missing), that's where it could be a problem. Say a media image was made up of 10 files (the original and 9 variations), but only 5 of those exist as expected, the addon will err on the side of not moving it to R2 since it's only partially available.

Can see you have WP-Optimize installed there... makes me wonder if it's doing something underneath it all like purging some of the variations, but then not updating WordPress' record about which variations should exist.

Depending on how database savvy you are, your wp_postmeta table is going to have a list of the variations that WordPress thinks should exist. The post_id will match the media ID and the meta_key will be _wp_attachment_metadata. If some of the expected variations are missing in the filesystem (for whatever reason) it won't move the media since it can't move it in its entirety.

It's certainly a possibility that some addon or theme or server process tried cleaning up your image variations, but didn't update the database to reflect that (and now there's a discrepancy on what WordPress thinks should be there and what is actually there).
 
Moving manually a png file work fine

1721504720440.png


Moving a SVG file manually did not work;. saying no

1721504831792.png



Should I delete wp-optimize? It is set up to optimize the database weekly.

If I install the regenerate thumbnail plugin, will that work?

here databse meta information

1721505389749.png
 
Honestly, I don't know anything about third-party plugins and what they are/aren't doing. If they work as intended, it should be fine. It should only be an issue if they are deleting WordPress's image variations, but not updating the WordPress database to tell WordPress *about* those changes.
 
Update after deleting wp-optimize and adding regenerate thumnaiil I am getting this error, as you say it does not exist in upload directory
How is that possible? I can actually see the image in the upload directory

1721506508179.png
 
Are you looking in the actual filesystem for the file? If those are attachments you moved to R2, they aren't going to be in the local filesystem, which is what I'm guessing WP-Optimize is limited to. I really doubt WP-Optimize is going to know how to to fetch them from R2.

I do wish WordPress used an abstracted filesystem like some other platforms use so that filesystem storage changes are automatically universal, but unfortunately it does not. So moving stuff out of the local file system is going to cause problems for third-party plugins that rely on files being there (they now exist in your R2 bucket, not in the local upload folder).
 
no files are actually in my upload folder in the file local system; its just not detecting the actual image. After clearing cloudflare cache, some images are now displayed properly and uploads seem to be showing pictures

I just uploaded a svg image and it uploaded but it shows blank when I click on the url It does show because it uploaded to R2 but when i link it to a header logo, it wont show

1721509709887.png

1721509738483.png


going directly to the link, the image does work fine



Adding it to the logo header wont show anything

1721509840057.png


Media libary show like this

1721509876691.png

I uploaded this image just now; there was no wp-optimize install I removed it before uploading it
 
If it's just SVG/SVGZ images that are causing an issue, check this thread:


Specifically, SVGs are unique in that they aren't *really* a binary image format, internally they are actually just an XML formatted text file, so by default R2 will serve them up with a mime type of application/xml, but for a browser to attempt to render them as an image, they need to have an image mime type.

Luckily, Cloudflare has a mechanism to set the mime type on them with their HTTP Response Transform Rules (see thread above).
 
still having the same issue what I did i delete all imagen and uploaded them all as svg and they migrate to R2 all
but now it wont show in media

I also added the serving rule. in the modify response header and its also enable

1721565925680.png

1721565953577.png
 
Do you have an image URL you could share from that page? Like if you right click one of the images to get the image URL?
 
Check your transform rule. It looks like content-type has a typo (should have seen it in your screenshot). It should be image/svg+xml, but it's currently imagen/svg+xml (an extra "n" in there).
 
Back
Top