Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 799 forks source link

Tiled Galleries: add option to serve the galleries without the CDN #36707

Closed HammyHavoc closed 7 months ago

HammyHavoc commented 7 months ago

Impacted plugin

Jetpack

What

Disable CDN functionality entirely to be able to serve images locally

How

A toggle. The URLs should be possible to to rewrite as required. The Tiled Gallery block still serves images via the likes of https://i0.wp.com/www.mydomain.com/, but with the CDN module deactivated in Jetpack, the thumbnails break.

If there's processing happening on the Jetpack CDN side, it makes even more sense to cache the end result locally rather than serve it up via the Jetpack CDN, although processing it 100% locally makes even more sense. When using CloudFlare, there's absolutely no necessity to use the Jetpack CDN.

At the very least, disabling the CDN module in Jetpack should make it explicitly clear what it can or might potentially break in terms of other functionality, though that's not a solution to the problem at hand, merely a reasonable suggestion to save hours of troubleshooting.

jeherve commented 7 months ago

If there's processing happening on the Jetpack CDN side, it makes even more sense to cache the end result locally rather than serve it up via the Jetpack CDN, although processing it 100% locally makes even more sense.

I'm afraid processing the images locally would not be possible. Resizing, optimizing, and creating new image formats on the fly takes a lot of processing power that is often not available on most shared hosting platforms. For the same reason, caching the end results locally would not be reasonable. The many image sizes would quickly cause many sites to run out of the storage space available on their server.

This is why Jetpack's CDN service exists: it provides you with the benefits of a CDN, as its name implies, but also gives you the processing power and storage needed to run the operations I mentioned above.

with the CDN module deactivated in Jetpack, the thumbnails break.

Could you tell me more about this? The Tiled Gallery block should continue to work, even when the CDN module is deactivated in Jetpack. We've purposefully built the feature so the block can be used when the CDN module is off. When you deactivate the CDN module the tiled gallery block continues to work just like before. When you deactivate the whole Jetpack plugin, the images will continue to be displayed, but you'll lose the tiled gallery effect.

If something breaks on your site or if it doesn't behave like I mentioned above, this is something we would need to look into. Could you contact us via this form and give us more details about your site there so we can take a closer look?

HammyHavoc commented 7 months ago

I really like a lot of what Jetpack does, some of it is even excellent, been using it since it began. However, with regard to the above in your comment, I sincerely feel like you're out of touch, and I've been out of touch myself in doing things a certain way, or thinking things haven't changed, it happens.

EWWW has 1m+ active installations, but a fraction of them use the cloud API for EWWW to run those calculations "in the cloud", so that begs to differ on how many people have enough horsepower and storage to do this kind of calculation on their hosting. You're also ignoring the large number of sites running on VPS and private hardware. Portainer is doing very well, lots of biz bringing their hardware in-house with dirt-cheap clusters of SBCs (free 3 node biz licenses) and sticking a free CloudFlare Tunnel and Zero Trust Access on the front-end to minimize attack-surface, preventing anyone from even accessing the admin area login forms, and zero port forwarding, thus no expensive hardware firewalls.

As with EWWW, Smush (1m+ active installations), reSmush.it (100,000 active installations) et al, for years now, people have been keeping both the original versions and umpteen versions of a file in various file formats. Storage really hasn't been a problem on hosting in a decade. Furthermore, most modern themes make extensive use of serving up different images to devices of different pixel densities, especially so now that converting your images to WebP (whilst still maintaining the original versions no less) is so easy and saves even more storage.

Funny thing is that Automattic could charge all those perceived people for access to image resizing in the cloud rather than have EWWW et al occupy that particular niche, though I don't really think there's much of a market, as it probably makes more sense for people to just upgrade their hosting than off-load their crunching.

I have quite literally 63TB of storage on my off-the-shelf home server, almost all of it is personal photos and videos taken from family cellphones and cameras over the past fifteen years (I noticed even teens seem to have GoPros, and lots seem to be "content creators" on YT, Twitch and TikTok; that generates a lot of video), a mirrored 8TB cache pool for editing video on, an LTO library of my own for archiving long-term, half a dozen dirt-cheap fanless SBCs in a cluster, and that's without even getting into biz stuff or what other biz owners I know are running day-to-day for serious work—it's incredibly cheap in 2024.

Then you've got the average Joe with his few hundred GBs or even TBs of cloud storage just for personal stuff, despite not being all that tech savvy. Also without even getting into what I'm running in terms of VPS for various public projects, and it's as cheap as shared hosting ever was. Not to mention stuff like Vultr and paying for what you use. Compute and storage are plentiful in 2024. If anything, we not uncommonly have an embarrassment of compute and storage, and waste the potential of the hardware we have at our disposal.

Are there people still running their website on crap hosting they're over-paying for? Sure. But I know people who are literally photographers running a biz by themselves and serving up their WordPress site from their off-the-shelf NAS with a CloudFlare Tunnel stuck on it; no static IP required with a CloudFlare Tunnel either. I also know someone running a salon, quite literally doing the same thing, CCTV goes to her off-the-shelf NAS, and she also serves up her WordPress site from it, again, CloudFlare Tunnel and ZTA. It barely breaks a sweat. This is what average non-nerds are doing just by following tutorials, querying LLMs or Reddit if they get stuck.

After a further few hours of troubleshooting, it seems that the Carousel module of Jetpack is actually what breaks the Tiled Gallery when it is enabled. There appear to be other oddities such as switching the Link for a Tiled Gallery block to Media making the images in the Gutenberg editor look too small to fit the spaces they're meant to fill when viewing the preview in the Gutenberg editor. Either way, with Carousel enabled, the thumbnails for the Tiled Gallery don't appear in the front-end, though they do appear in the Gutenberg editor.

If you did wish to probe further, I would need to making the staging server available to you as we can't mess around too much on the live site, and for that I will need to have a further conversation to get the OK for it—it's all protected by Zero Trust Access, because of course it is in 2024.

Have a good day though, all the above is intended to positively inform than chastise.

jeherve commented 7 months ago

Thanks for the detailed feedback. While I don't think those hosting options and configurations represent the majority of WordPress sites today, there are indeed quite a few options that allow you to host, process, and serve images from your own server nowadays. Jetpack's CDN aims to save you the trouble of setting all that up and maintaining it, while also offering you the benefits of a CDN, something that is increasingly important in a world where your site visitors do not always live next door from your server. I understand that it's not something everyone needs. As you mentioned, some folks are perfectly happy to run their site off their NAS at home, and use tools like Cloudflare to help with delivery. In this case, Jetpack remains available and one can disable the CDN option and rely on other gallery blocks, like WordPress' own gallery block.

After a further few hours of troubleshooting, it seems that the Carousel module of Jetpack is actually what breaks the Tiled Gallery when it is enabled. There appear to be other oddities such as switching the Link for a Tiled Gallery block to Media making the images in the Gutenberg editor look too small to fit the spaces they're meant to fill when viewing the preview in the Gutenberg editor. Either way, with Carousel enabled, the thumbnails for the Tiled Gallery don't appear in the front-end, though they do appear in the Gutenberg editor.

If you did wish to probe further, I would need to making the staging server available to you as we can't mess around too much on the live site, and for that I will need to have a further conversation to get the OK for it—it's all protected by Zero Trust Access, because of course it is in 2024.

I'd be happy to take a closer look at this to try to understand and reproduce the problem. Could you contact us via the contact form I mentioned above, and mention this GitHub issue? My colleagues will pass this on to me and I'll take a closer look!

Thank you!