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.58k stars 797 forks source link

Latest Instagram Posts Block: crop or add black bars when images returned from Instagram are not in a 1:1 ratio. #22241

Open loyukfai opened 2 years ago

loyukfai commented 2 years ago

Impacted plugin

Jetpack

What

I would like the Instagram Latest Post Block Always Show Images in Square Shape

How

image

Sometimes, the block doesn't show all images in square shape, it seems to be dependent on the images uploaded to Instagram. If in a particular row, the images are originally uploaded in portrait orientation, then the block will show them in portrait as well.

jeherve commented 2 years ago

Do you see this issue on your own site right now? If so, could you post the URL here so we can take a closer look?

If you'd rather not share your URL, you can send it to us and mention this issue via this contact form: https://jetpack.com/contact-support/?rel=support&hpi=1


Possibly related: #15979

loyukfai commented 2 years ago

Yes sure, https://www.peacebazaarhk.com/

Maybe related to #15979, but not AMP related.

jeherve commented 2 years ago

The original Instagram images seem to have a different aspect ratio as well: the first images have a 4:3 ratio, hence the black bars at the top and bottom of the image on the Instagram site:

Screenshot 2022-01-07 at 13 33 32

The following images have a 1:1 ratio, and thus have no black bars:

Screenshot 2022-01-07 at 13 32 20

I believe that's what's causing the difference here.

Did you add those images somewhat differently?

loyukfai commented 2 years ago

Not really, I guess currently, if the images in the same row are 4:3, then the widget will make the row "shorter" as well.

Though for Instagram normally images are shown in square when in a "wall" state AFAIK.

jeherve commented 2 years ago

if the images in the same row are 4:3, then the widget will make the row "shorter" as well.

Yes, that's the idea.

Though for Instagram normally images are shown in square when in a "wall" state AFAIK.

Yes, that could be a nice improvement; we could see about adding black bars like they do on Instagram.

loyukfai commented 2 years ago

Can it be like how Instagram works, that it will crop the images into square instead?

image
jeherve commented 2 years ago

That would be another option indeed. 👍

loyukfai commented 2 years ago

Hi any news? 😊

nagpai commented 2 years ago

5219566-zd

hacchism commented 2 years ago

Another report: 34947824-hc

loyukfai commented 2 years ago

Is this going to be changed?

StefMattana commented 2 years ago

This GH issue has been mentioned on this forum thread: https://wordpress.org/support/topic/instagram-widget-square-crop/

The user reports the result is inconsistent between platforms and browsers.

desnum commented 2 years ago

A case where adding a (rectangular) video in Instagram throws off the ratio making the row rectangles and not squares: 36111990-hc

github-actions[bot] commented 2 years ago

Support References

This comment is automatically generated. Please do not edit it.

loyukfai commented 2 years ago

Other related forum threads:

https://wordpress.org/support/topic/latest-instagram-posts-block-in-jetpack-10-0/

https://wordpress.org/support/topic/cropping-pictures-to-square-in-latest-instagram-posts-block/

Cheers.

jeherve commented 1 year ago

This was also reported in this issue: https://github.com/Automattic/wp-calypso/issues/66653

Of note:

Example Markup on 2022-09-13 at 10:32:30

Workaround details

.wp-block-jetpack-instagram-gallery .wp-block-jetpack-instagram-gallery__grid-post img {
    height: 100px !important;
}
loyukfai commented 1 year ago
.wp-block-jetpack-instagram-gallery .wp-block-jetpack-instagram-gallery__grid-post img {
  height: 100px !important;
}

Thanks a lot for looking into this, will wait for the fix.

Just FYI, this CSS hack doesn't really work well across different screen sizes. For instance, it makes the IG photos show up as rectangular blocks on one of my phones.

Cheers.

loyukfai commented 1 year ago

Hi any news?

cuemarie commented 1 year ago

Ran into this again here: 6455055-zd-woothemes

Providing CSS to resolve, with a slight adaptation to take into consideration the feedback from @loyukfai above (thanks!):

.wp-block-jetpack-instagram-gallery .wp-block-jetpack-instagram-gallery__grid-post img {
    aspect-ratio: 1 / 1;
}
Gustavo-Hilario commented 1 year ago

Another report here: 6756223-zen

The above CSS code helped to temporarily fix this.

jeherve commented 4 months ago

Also in #37383

ezebecke commented 4 days ago

Also in 8737127-zen

Fixed with CSS code.