woocommerce_gallery_thumbnail_size hook not documented properly
#24,707 opened on Sep 27, 2019
Description
Describe the bug
The docs suggest that the default value of woocommerce_gallery_thumbnail_size should be the string woocommerce_gallery_thumbnail. Looking at the code, it's actually passed the explicit width and height from that defined image size.
Further (perhaps worthy of its own ticket), if the size has been filtered to soft crop, this actually causes issues because the file name won't end in 100x100 (or the custom defined size). It'll be 100xY where Y is the resulting height from maintaining the aspect ratio. Seems to me that the code should actually use the string rather than the width and height it fetches.
To Reproduce Steps to reproduce the behavior:
- Create a new Woo install
- Add images to a product gallery
- View product
- See thumbnails are 100x100
- Add a filter to
woocommerce_get_image_size_gallery_thumbnailand setcropto false - Regenerate thumbnails
- View product
- Thumbnail will not be 100 width w/ maintained aspect ratio. May even 404 if
image_downsizedoesn't find an applicable match.
Expected behavior Documentation should match, and, IMO, image size string should be used and let WP core determine width/height
Isolating the problem (mark completed items with an [x]):
- I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
- This bug happens with a default WordPress theme active, or Storefront.
- I can reproduce this bug consistently using the steps above.
WordPress Environment
WordPress address (URL): https://ex-guard.test/wp Site address (URL): https://ex-guard.test WC Version: 3.7.0 REST API Version: ✔ 1.0.2 Log Directory Writable: ✔ WP Version: 5.2.3 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: –
Server Environment
Server Info: nginx/1.15.8 PHP Version: 7.3.6-1+ubuntu18.04.1+deb.sury.org+1 PHP Post Max Size: 100 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 cURL Version: 7.58.0 OpenSSL/1.1.1c
SUHOSIN Installed: – MySQL Version: 5.5.5-10.4.6-MariaDB-1:10.4.6+maria~bionic-log Max Upload Size: 100 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔
Database
WC Database Version: 3.7.0 WC Database Prefix: wp_k0rwjer9fn_ Total Database Size: 42.20MB Database Data Size: 31.68MB Database Index Size: 10.52MB wp_k0rwjer9fn_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_order_items: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_order_itemmeta: Data: 0.17MB + Index: 0.16MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_aryo_activity_log: Data: 0.31MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_comments: Data: 0.09MB + Index: 0.09MB + Engine InnoDB wp_k0rwjer9fn_customizer: Data: 0.16MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_customizer_custom_image: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_download_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_facetwp_index: Data: 0.20MB + Index: 0.31MB + Engine InnoDB wp_k0rwjer9fn_ff_cache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_comments: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_image_cache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_options: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_posts: Data: 0.13MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_post_media: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_snapshots: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_streams: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_ff_streams_sources: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_gf_addon_feed: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_gf_draft_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_gf_entry: Data: 0.11MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_gf_entry_meta: Data: 0.41MB + Index: 0.63MB + Engine InnoDB wp_k0rwjer9fn_gf_entry_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_gf_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_gf_form_meta: Data: 0.17MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_gf_form_revisions: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_gf_form_view: Data: 0.13MB + Index: 0.11MB + Engine InnoDB wp_k0rwjer9fn_iwp_backup_status: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_iwp_processed_iterator: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_options: Data: 2.48MB + Index: 0.06MB + Engine InnoDB wp_k0rwjer9fn_postmeta: Data: 14.52MB + Index: 4.03MB + Engine InnoDB wp_k0rwjer9fn_posts: Data: 2.52MB + Index: 0.80MB + Engine InnoDB wp_k0rwjer9fn_redirection_404: Data: 1.02MB + Index: 0.47MB + Engine InnoDB wp_k0rwjer9fn_redirection_groups: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_redirection_items: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_k0rwjer9fn_redirection_logs: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_k0rwjer9fn_relevanssi: Data: 1.52MB + Index: 1.52MB + Engine InnoDB wp_k0rwjer9fn_relevanssi_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_relevanssi_stopwords: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_rg_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_rg_form_meta: Data: 0.03MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_rg_form_view: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_rg_incomplete_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_rg_lead: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_rg_lead_detail: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_k0rwjer9fn_rg_lead_detail_long: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_k0rwjer9fn_rg_lead_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_k0rwjer9fn_rg_lead_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_smush_dir_images: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_terms: Data: 0.20MB + Index: 0.22MB + Engine InnoDB wp_k0rwjer9fn_term_relationships: Data: 0.38MB + Index: 0.34MB + Engine InnoDB wp_k0rwjer9fn_term_taxonomy: Data: 0.20MB + Index: 0.25MB + Engine InnoDB wp_k0rwjer9fn_usermeta: Data: 0.27MB + Index: 0.28MB + Engine InnoDB wp_k0rwjer9fn_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_k0rwjer9fn_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_k0rwjer9fn_wc_product_meta_lookup: Data: 0.05MB + Index: 0.09MB + Engine InnoDB wp_k0rwjer9fn_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_k0rwjer9fn_wpml_mails: Data: 5.52MB + Index: 0.00MB + Engine InnoDB
Security
Secure connection (HTTPS): ✔ Hide errors from visitors: ❌Error messages should not be shown to visitors.
Active Plugins (1)
WooCommerce: by Automattic – 3.7.0
Inactive Plugins (49)
Activity Log: by Activity Log Team – 2.5.2 AddToAny Share Buttons: by AddToAny – 1.7.37 Advanced Custom Fields: Font Awesome: by mattkeys – 3.1.1 Advanced Custom Fields PRO: by Elliot Condon – 5.8.4 Advanced Excerpt: by WPKube – 4.3.1 All In One SEO Pack: by Michael Torbert – 3.2.6 Anti-spam: by webvitaly – 5.5 Capability Manager Enhanced: by PublishPress – 1.7.5 Classic Editor: by WordPress Contributors – 1.5 CMB2: by CMB2 team – 2.6.0 Compress JPEG & PNG images: by TinyPNG – 3.2.0 Debug Bar: by wordpressdotorg – 1.0 Debug Bar List Script & Style Dependencies: by Per Soderlind – 1.1 Download Gate for Gravity Forms: by Ethan Clevenger – 1.0.0 Enable Media Replace: by ShortPixel – 3.3.6 Envato Market: by Envato – 2.0.1 Ex-Guard: by Sterner Stuff Design – FacetWP: by FacetWP LLC – 3.4.1
FacetWP - Conditional Logic: by FacetWP LLC – 1.3.0
FacetWP - Hierarchy Select: by FacetWP LLC – 0.4.1
FedEx WooCommerce Shipping with Print Label: by PluginHive – 4.3.0 – Not tested with the active version of WooCommerce FlippingBook - Sterner Stuff: by Sterner Stuff Design – 1.3.1 Flow-Flow Lite: by Looks Awesome – 3.1.25 GDPR Cookie Consent: by WebToffee – 1.8.0 Gravity Forms: by rocketgenius – 2.4.12 Gravity Forms Delayed Notifications: by Tomasz Zewlakow – 1.0 InfiniteWP - Client: by Revmakx – 1.9.4.1 Mailgun: by Mailgun – 1.7.1 Permalink Manager Pro: by Maciej Bis – 2.2.5 – Not tested with the active version of WooCommerce PixelYourSite: by PixelYourSite – 7.1.1 Polylang: by WP SYNTEX – 2.6.4 Product Customizer: by K2-Service – 2.5.22 – Not tested with the active version of WooCommerce Query Monitor: by John Blackbourn – 3.3.7 Redirection: by John Godley – 4.3.3 Redis Object Cache: by Till Krüss – 1.4.3 Relevanssi: by Mikko Saari – 4.3.2 Simple Custom Post Order: by Colorlib – 2.4.4 User Switching: by John Blackbourn & contributors – 1.5.2 WDS CPT Core: by WebDevStudios.com – 1.0.2 What The File: by Never5 – 1.5.4 WooCommerce Composite Products: by SomewhereWarm – 4.0.6 – 5.0.2 is available – Not tested with the active version of WooCommerce WooCommerce Stacked Product Layout: by SomewhereWarm – 1.2.1 – Not tested with the active version of WooCommerce WooCommerce Vehicle Parts Finder - Make/Model/Year/Engine/Category/Keyword: by The WP Instinct Team – 3.0 – Not tested with the active version of WooCommerce WP fail2ban: by Charles Lecklider – 4.2.5 WP Migrate DB Pro: by Delicious Brains – 1.9.8 WP Migrate DB Pro CLI: by Delicious Brains – 1.3.5 WP Migrate DB Pro Media Files: by Delicious Brains – 1.4.14 WP Offload Media: by Delicious Brains – 2.2.1 WP Store Locator: by Tijmen Smit – 2.2.23
Must Use Plugins (3)
Bedrock Autoloader: by Roots – 1.0.0 Disallow Indexing: by Roots – 1.0.0 Register Theme Directory: by Roots – 1.0.0
Settings
API Enabled: ✔ Force SSL: ✔ Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: composite (composite) external (external) grouped (grouped) simple (simple) variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5)
Connected to WooCommerce.com: ✔
WC Pages
Shop base: #14 - /store/ Cart: #15 - /cart/ Checkout: #16 - /checkout/ My account: #17 - /my-account/ Terms and conditions: ❌ Page not set
Theme
Name: Storefront Version: 2.5.3 Author URL: https://woocommerce.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔
Templates
Overrides: –
Action Scheduler
Complete: 3 Oldest: 2019-08-30 13:30:34 -0500 Newest: 2019-09-24 16:01:13 -0500
Pending: 0 Oldest: – Newest: –
Canceled: 0 Oldest: – Newest: –
In-progress: 0 Oldest: – Newest: –
Failed: 0 Oldest: – Newest: –
</details>