App for Cloudflare® Pro

App for Cloudflare® Pro 1.9.9

  • Item seller Item seller Shawn
  • Featured

Plugin support

modeltourism

New member
Hi,

Any potential for supporting ShortPixel with your plugin? Currently, if we upload a photo it bypasses ShortPixel and goes straight to R2 😀

Additionally, when we move media from WP to R2, it does find all the .jpg files as listed in the WP database, but it doesn't take any of the .webp images that ShortPixel makes.. 🙁
 
Would need to go digging on ShortPixel's code to say for certain on anything... While it's not out of the question, if they are bypassing WordPress functionality (like not using WordPress's normal system for tracking media variations), not sure it could really be done.

Again, would need to go digging before I can say definitively, but it definitely makes me curious about why they are choosing to not use the native WordPress mechanism for doing exactly what they are doing (creating variations of images).
 
Let us know if we can help in any way with this - at the moment, we've had to turn off the R2 part of your plugin - that said, the work you've done is excellent in the plugin with the other features too (we do know our way around CF already to be fair, but nice to have it in the WP dashboard for minor changes!) - so happy to have paid to support you 🙂
 
Let us know if we can help in any way with this - at the moment, we've had to turn off the R2 part of your plugin - that said, the work you've done is excellent in the plugin with the other features too (we do know our way around CF already to be fair, but nice to have it in the WP dashboard for minor changes!) - so happy to have paid to support you 🙂
Haven't installed it yet, but already skimming their code to see if anything obvious pops out at me. As I mentioned already, it does strike me as odd that they would be not using the mechanism that WordPress gives you to manage image variations because it's literally what it's there for (and in every installation of WordPress since it's part of WordPress core).

Hopefully I can figure out why they went that route and come up with a solution.
 
Out of interest, how do you determine what order things happen in? Ie, do you pause after an upload to see if any other WP plugin wants to do something with an image before you move it to R2? Just wondered how plugins are given priority to those functions!
 
In this case, you can set a specific execution order number for WordPress filters. In *theory* things should be designed so multiple plugins using the same WordPress hook aren't affected by execution order. In practice it's definitely problematic because you have no way of controlling another plugin's execution order value. You can set it very high if you want it to execute later, but it's still not always going to execute last because another plugin might also want to execute last and simply picked a higher arbitrary number. And then you have the issue where maybe you want to execute early because of ThirdPartyPluginA, but also somehow execute late at the same time because of ThirdPartyPluginB.

In this particular case, App for Cloudflare and ShortPixel are doing their "heavy lifting" within the same WordPress hook (which makes sense because both are dealing with incoming images being uploaded). Both plugins are using WordPress' default execution order, which also makes sense because as mentioned above, forcing a plugin to the end of the execution order might cause other problems (fixing one problem that causes another is never good).

ShortPixel is a lot of code to get through, and it does look like they have a lot of filters/hooks we could utilize, so I'm hopeful I can make it work regardless of execution order.

Honestly, internally WordPress core is a mess and plugin developers are still able to make things work somehow (usually). WordPress core could be designed in a way where plugin developers don't need to create one-off code to support every specific plugin they want to be compatible with. Unfortunately that's how WordPress core more or less works because it's a ton of code from PHP versions 20 years ago.
 
Been monkeying around with it, and so far I can kind of make it work, but it requires breaking some safety checks that ShortPixel has in place. Specifically I can force it so ShortPixel is tricked into thinking the files exist, but it uses that to do other things. For example, it uses the same check to verify that an image conversion worked as expected and if it did, delete the original images. The issue there is if their image conversion failed (for whatever reason), we just tricked it into thinking it worked and it deletes the original image.

Honestly, I don't particularly love the fact that I need to break their file checks that they also use to make sure things worked on their end. It feels a little like trying to fix a car with duct tape. Ya, it kind of will work... until it doesn't.

Just out of curiosity, are there specific features you are using ShortPixel for? I ran into something similar for another user where they just were trying to convert incoming images to WebP (I forget which plugin they were using), and it ended up just being easier to add that feature than it was trying to force things to work with that particular plugin.

It's still not out of the question, but in order to do it "right", probably going to require a little cooperation from ShortPixel devs.
 
There are various image optimization services for wordpress. Shortpixel, Imagify and Elementor are the most popular ones. Woodmart (Xtemos) Image Optimizer is another.
We need a way to optimize images before it goes to R2 and also those that are in r2. (Could be done by downloading them, then optmizing images and send it back to R2.
Shortpixel now supports WP Offload, which does something similar to your plugin:
It seems to me that if you contact ShortPixel, it should be possible to get integration working without breaking their code.
 
I’ve actually reached out to them before, but never heard back.

It would be nice if WordPress had an abstracted filesystem where everything just worked with that without custom code needed for every plugin to work with every other plugin. But unfortunately it’s a drawback of WordPress.

I did end up releasing a plugin that can convert things to WebP and/or AVIF, as well as support watermarking. It doesn’t require a third party server (your images aren’t sent to other servers) or costs. If it’s just image conversion you are after, that might be a simpler route.


ShortPixel doesn’t internally have the necessary hooks for making anything compatible with their plugin, so compatibility would need to come from them unfortunately. I’ll also reach out again to them.
 
I'm after lossless image compression with smartcompress or similar, so we can serve up high quality / retina images with low sizes. We have image heavy ecommerce sites and need to optimise for speed. We run the popular Xtemos Woodmart theme. The theme will need to find the image in the original location or there has to be a method to let the theme display the correct image. I guess this will be the same for most themes.

Shortpixel supports WP Offload by WP Engine and you've probably heard about the drama around it. It seems to me that shortpixel should be able to support your plugin. Their devs can be reached if their supports forwards your request to them. Maybe ask them to do so.

Alternatively, integration with Imagify could work. But it seems Shortpixel is better.
 
Back
Top