Releases: ivanusto/just-gcs-offload
Release list
Release v1.5.1
What's Changed
Full Changelog: v1.5.0...v1.5.1
Release v1.5.0
What's Changed
- Cut GCS request volume, fix silently-lost thumbnails, and support WordPress 7.1 media by @ivanusto in #1
New Contributors
Full Changelog: v1.4.0...v1.5.0
Release v1.4.0
Fixed
Sub-sizes requested as array( width, height ) always returned the full-size original.
gcs_image_downsize() had a fallback branch that, for any array size, returned the
full-size file while reporting the requested dimensions as though they were real.
Size resolution is now delegated to WordPress core's image_get_intermediate_size(),
which picks the smallest sub-size that is large enough and matches the aspect ratio.
This was most visible on the site icon. get_site_icon_url() requests
array( 32, 32 ), array( 180, 180 ), array( 192, 192 ) and array( 270, 270 ),
so all four <link rel="icon"> tags pointed at the full-size image while
advertising sizes="32x32" and friends. They now resolve to site_icon-32,
site_icon-180, site_icon-192 and site_icon-270 respectively.
The site icon is no longer offloaded.
WordPress prints its URLs into the document head on every page load, so serving it
from the bucket made every page depend on the bucket or CDN being reachable, and made
/favicon.ico redirect off-origin — which some favicon crawlers handle poorly. The
site icon now always stays on the local site.
The check covers the freshly-cropped case too: wp_ajax_crop_image() inserts the
cropped attachment before update_option( 'site_icon', $id ) runs, so the option
alone would miss every newly set icon. _wp_attachment_context is checked as well.
All three code paths that record an offload honour the rule — the media handler, both
WP-CLI sync loops, and the bulk sync on the settings screen — so wp gcs-offload sync-all or a bulk run can no longer silently re-offload the icon.
readme.txt declared MIT while LICENSE, the plugin header and README.md all
declared GPL-2.0. Plugin Check flags this as a license_mismatch error.
Added
just_wp_gcs_skip_attachment — exclude any attachment from offload:
add_filter( 'just_wp_gcs_skip_attachment', function ( $skip, $attachment_id ) {
return $skip || get_post_meta( $attachment_id, 'keep_local', true );
}, 10, 2 );This is a write-side policy: it decides whether an attachment is offloaded at all.
It deliberately does not affect URL rewriting for attachments that were already
offloaded, because their local sub-size files may have been removed by the
"delete local files" option.
Upgrade notes
An existing install keeps serving an already-offloaded site icon from the bucket,
because this release only changes what gets offloaded from now on. To move it back to
the local site, either set the site icon again from the admin, or clear its marker:
wp post meta delete $(wp option get site_icon) _wp_gcs_info
wp cache flushCheck your local files still exist first — if "delete local files" is enabled they may
have been removed, in which case setting the icon again is the safe route.