Photos are distorted/blurry when rendered on the webpage

Hello Community/Support Staff --
I have an issue where some images displayed on my website are appearing distorted or blurry. These images are displayed using a plugin called "Staff Directory". They are a featured image upon each staff member.

I have the following plugins.

-Photon (Jetpack)
-WP Smush
-Hummingbird

That should be the only plugins that change the output of things.

Anything I'm missing to get the images to appear better?

https://cityofhanahan.com/government/fire-department/

Above page is an example of the "Staff" on the left side of the page.

  • Adam Czajczyk

    Hello David,

    I hope you're well today and thank you for your question!

    I checked the site and I can see that "profile" images of the firemen are distored. There are "two issues in one" here but both are related.

    The original images are small also are not all "square" (the same width and height). They seem to be resized with CSS to fit the square box (container). For example, an image of the first man at the top is originally 200 x 133px while the image container is 200x200px. Therefore the image gets upscaled in height.

    Rescaling images from smaller to bigger will always result in worse quality (hence blurry image) and also scaling just one dimension - vertical in this case - will always distort image.

    That being said, I'm not sure about the plugin that you are using there and its options but the simplest way would be to make sure that images are fitted to their containers in width only. This could be achieved with this CSS rule:

    .person-photo img {height:auto;}

    To apply it to your site please put this code to the "style.css" file of your child-theme (if you are using one) or to the custom css option of your current them or via a Simple Custom CSS plugin.

    In case it didn't work, try this version please:

    .person-photo img {height:auto!important;}

    Let me know if that helped, please!

    Best regards,
    Adam

  • Adam Czajczyk

    Hello David!

    Thank you for this information!

    I tried to access your site to check it as support access seems to be granted but it's not letting me in, expecting me to "connect your site with WordPress.com". I suppose there's some additional login tool enabled then.

    I could try to test it on my own setup though, I think. Is this the plugin you are using?

    https://wordpress.org/plugins/staff-directory/

    Best regards,
    Adam

  • Adam Czajczyk

    Hello David!

    I checked the plugin on my end but no luck so far.

    Unfortunately, I'm still not able to access your site as well as it still want's me to login to it even though I'm using the support access button. The support access feature is supposed to redirect me to the site /wp-admin area with no need to put any login and password and even knowing it.

    It seems though that there's still something interfering. Since I may need to check other parts of your site such as e.g. template files I would like to try a more "direct" approach. That being said, please send in:

    Subject: "Attn: Adam Czajczyk"

    - Mark to my attention, the subject line should contain only: ATTN: Adam Czajczyk
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - login URL and admin account login credentials (may be a temporary admin account) data
    - Include FTP log-in details (hostname, username & password)
    - Include hosting control panel access details (login address, username & password) - cPanel's usually the control panel used for this, but your provider may use something else; I'll need this for accessing your site's database, preferably via phpMyAdmin
    - Include any relevant URLs for your site

    Please use our contact form here http://premium.wpmudev.org/contact/

    Select "I have a different question" from the drop-down list. 

    Please be sure to make a full backup of your entire site first!

    Best regards,
    Adam

  • Adam Czajczyk

    Hello David!

    I got your message and I was able to access your site.

    I checked it and the main culprit here is Jetpack's Photon module.

    The Staff Directory plugin is using thumbnails as images which is pretty understandable and expected. On your site these are set to be 200x250 pixels with no cropping to actual dimensions. That's okay.

    With current CSS settings (where the width of an image container for staff images is 200px) with Photon disabled, images are being fetched directly from your site's MediaLibrary and seem to look fine.

    With Photon enabled though they are taken from WordPress.com CDN. However, Photon is trying to read out what dimensions should be used and is re-scaling those images to the smallest available size that would fit in a container. Such an image "gets back" to the site and is then "scaled back" by CSS to fit site design.

    Furthermore, Photon is caching images and according to Jetpack's docs this cache cannot be cleard - it's "for forever". The only way to clear it would be to rename all these images but that wouldn't be an easy task and I'm not sure how they would be scaled by Photon again.

    The bottom line here is that I think you could either try to show smaller images or accept the current "quality" or disable Photon module for good.

    An alternative would be to "hack" the Staff Directory plugin to use a full size image instead of thumbnail but I never recommend changing plugin's files as it may lead to other unexpected issues and the changes would be overwritten at first update.

    Best regards,
    Adam

  • David

    Adam Adam Czajczyk
    Thank you for investigating. I have turned off Photon. Perhaps that was the problem with some images rotating as well. However, I still seem to have a quality issue.

    https://cityofhanahan.com/government/police-department/

    If you look at that page, two of the staff persons appear to be blurry. Upon further investigation, I found the image source and it's a lower grade quality image used. Both those pictures are high resolution photos that are degraded and look bad in it's current form.

    Do you think that is just the way it's going to be until the plugin can do something different?,

  • Adam Czajczyk

    Hello David!

    I took another look at the site. I suppose one of that photos you are referring to is a photo of a "Captain Michael ..." (the one with a flag in background), right?

    As I said before, your Media Library is set to use thumbnails of a size of 200 x 250 pixels and "crop to exact dimensions" option is disabled. This means that during an upload WordPress creating thumbnails out of original images in a way to make to make "fit longest sizes of an image".

    I mean:

    - your thumbnails are set to be 200 pixels wide and 250 pixels tall
    - each image thumbnail is resized by comparing its longer side to the longer dimension so for example: a 1000 x 2500 pixels image thumbnail will be set to 100 x 250 pixels and 2000 x 1000 pixels image thumbnail will be set to 200 x 100 pixels.

    Thumbnail of Mr. Michael photo was set to 166 x 250px. Now, when it's put into the 200px wide container, its upscaled by CSS so it's width would be 200px. As I explained before, upscaling always degrades quality.

    You can make that better by setting your WP thumbnail size (on "Settings -> Media" page) to e.g. 300x350px and then using "Regenerate Thumbnails" plugin to re-create thumbnails in a new size.

    This will however affect all the thumbnails of all images on your site, not only those used by Staff Directory plugin. It shouldn't be a "big deal" though in my opinion as it's always easier to make images smaller with CSS than make them bigger.

    Best regards,
    Adam

  • David

    Adam Czajczyk

    Ironically, when I refreshed and read this, I had just started doing that. I am regenerating all thumbnails currently.

    Do you think I should then limit the height back from "auto" once this gets done? This should keep the quality of the image. Since there will be a few images that are longer than taller so they all look the same in the staff directory?

    Thanks for all your help btw.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.