janboddez / share-on-mastodon

Easily share WordPress posts on Mastodon.
https://jan.boddez.net/wordpress/share-on-mastodon
GNU General Public License v3.0
39 stars 5 forks source link

Jetpack sometimes messes up image paths #22

Closed janboddez closed 2 years ago

janboddez commented 2 years ago

May in fact be the root cause of #17.

Jetpack's Photon module changes the image URL of thumbnails (but not, it seems, the outcome of wp_get_attachment_url()). This results in a broken image path, and the image is subsequently not uploaded.

This can be disabled: https://github.com/Automattic/jetpack/blob/master/projects/plugins/jetpack/class.photon.php#L707. This may very well be the way to go. Alternatively, we could always upload the original image instead of the "large" thumbnail (when available, we fall back to the original anyways, in case it doesn't).

Note: This does normally not happen when posting from WP Admin. (It could, though, it depends.)

janboddez commented 2 years ago

Long story short: don't use wp_get_attachment_image_src. Or, prevent Jetpack from altering it. Or, if that still doesn't lead us to the correct local file path, upload the original image instead. Something like that.

sjimwillis commented 2 years ago

fwiw, this s the URL that's getting passed around in the function:

https://i0.wp.com/www.jimwillis.org/wp-content/uploads/2022/03/conversations-with-myself-gatefold-edition.jpg?fit=800%2C800&ssl=1