• Plans & Pricing
  • Log in
  • Get started
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress 
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Get started
  • Sign up
  • Log in
About
  • Plans & Pricing
Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress  
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Jetpack App
  • Learn more
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Search
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Forums / Image resize issue: css solution

Image resize issue: css solution

  • Unknown's avatar
    racocobdf10654e8 · Member · Feb 26, 2025 at 5:24 pm
    • Copy link Copy link
    • Add topic to favorites Add topic to favorites

    I wish to document a solution I have to a ‘scale image’ problem I wrestled
    with. It was agonizing getting to a solution so I want to post what I did so
    that other non-UI developer types may benefit from my pain!

    The problem was that a photo I took of a book, which was standing
    upright so that I could post the binder edge (that had title, author,
    publisher detail; the from cover was blank). The resulting (cropped) photo was
    obviously thin (just the book binder width) and comparatively tall.

    When I imported the image into my WordPress/WooCommerce Product page, it was ridiculously tall. It made the Product page look amateurish: one had to scroll
    more than a full browser screen of mostly blank page (just a skinny, tall
    book).

    I tried scaling it in Gimp, even flattening the image and setting its height to
    6″. That had zero effect. I played around with pixel density settings, using
    %-age instead of absolute heights, etc. Absolutely nothing worked. Anything I did in GIMP was a no-op when imported into my Product page. I have no
    idea why. (Any imaging experts out there that can explain why?)

    Finally, I had to resort to a coding solution. I am not a UI developer so this was a struggle to figure out. Also, I was not able to find my Product pages anywhere in any WordPress directory (under public_htmp/wp). I assume that WP generates HTML code via .php functions at page request time? ANyone know?

    What I finally got to work was the following:

    * Bring up WordPress admin: https://<your domain>/wp/wp-admin
    
    * Select the Customizer (https://<your domain>/wp/wp-admin/customize.php)
    
    * In the left vertical frame, expand the "Additional CSS" menu selection

    In the “Customizing Additional CSS” dialog, I added these two lines.

    .woocommerce div.product div.images img,
    .woocommerce ul.products li.product a img{ width: auto; height: 500px; }

    For me, it was critical that I kept the width set to “auto”. I suspect that was
    because I didn’t want it to be proportionally reduced with any height reduction since I cropped the original photo. I could not afford to lose any image width.

    The value of 500px for the height worked for me: the image size I chose worked well for all of my Product pages, at least so far.

    Note: You can determine the CSS class names above by going to the Parent page that had the link to the Product page where the image resided. I right-mouse-clicked on that Parent page to bring up the context menu where I selected the
    “view page source” menu item.

    Also note that the above CSS setting will be applied to all Product page images
    so I suppose it might be a problematic solution for some. For me it continues
    to work great.
    You can see examples at: https://racoco.net/wp/home/reading-media/

    Hope this is helpful to someone else.

    Rich

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar
    honhonjaccuse · Member · Feb 26, 2025 at 7:24 pm
    • Copy link Copy link

    Thanks for sharing! I will mark the topic as resolved.

  • The topic ‘Image resize issue: css solution’ is closed to new replies.

Tags

  • account
  • CSS
  • currency
  • design
  • images
  • import
  • Jetpack
  • menu
  • payment
  • WooCommerce

About this topic

  • In: Support
  • 2 participants
  • 1 reply
  • Last activity 10 months
  • Latest reply from racocobdf10654e8

Couldn't find what you needed?

Contact us

Contact us

Get answers from our AI assistant, with access to 24/7 expert human support on paid plans.

Browse our guides

Browse our guides

Find step-by-step solutions to common questions in our comprehensive guides.

WordPress.com

Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Professional Email
  • Website Design Services
  • WordPress Studio
  • Enterprise WordPress
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • WordPress.com Blog
  • Business Name Generator
  • Logo Maker
  • WordPress.com Reader
  • Accessibility
  • Remove Subscriptions
Help
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
  • Developer Resources
Company
  • About
  • Press
  • Terms of Service
  • Privacy Policy
  • Do Not Sell or Share My Personal Information
  • Privacy Notice for California Users
DeutschEspañolFrançaisBahasa IndonesiaItalianoNederlandsPortuguês do BrasilSvenskaTürkçeРусскийالعربيةעִבְרִית日本語한국어简体中文繁體中文English

Mobile Apps

  • Download on the App Store
  • Get it on Google Play

Social Media

  • WordPress.com on Facebook
  • WordPress.com on X (Twitter)
  • WordPress.com on Instagram
  • WordPress.com on YouTube

Automattic

Automattic
Work With Us
    • WordPress.com Forums
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • Manage subscriptions