Open laurelfulford opened 7 years ago
Related theme tickets:
4024-wpcom-themes 3965-wpcom-themes
Related: #4175
There's another report of this, with the Intergalactic 2 theme:
5013-wpcom-themes, 972453-zd
When this is fixed, this thread needs follow up: https://wordpress.org/support/topic/portfolio-image-size-problem-with-photon-plugin?replies=1
Related: 973272-zen In this particular case Photon overrides the element width and height attributes and just sets the width to the parent element.
Wondering if this issue is going to be fixed. A self-hosted user first posted about it here, https://wordpress.org/support/topic/full-image-and-jetpack-photon/, and then reposted just recently here, https://wordpress.org/support/topic/conflict-with-photon-still-not-fixed/.
@thesacredpath We don't have an ETA at the moment, but we will update this issue when we make some progress on this.
cc @RavanH
Thanks @jeherve, I'll let the user know.
Thanks @jeherve for alerting me to this thread. I'm currently using the CSS (added to Custom CSS) kindly suggested by @dcoleonline on https://wordpress.org/support/topic/full-image-and-jetpack-photon/ and it seems to work well...
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
This is still happening. Found it in #4284341-zen with Morden.
Another one. Found it in #4645708-zen with Exford.
An issue has been reported with the Espied theme on self-hosted sites, where Photon is enabled.
On the Portfolio Project pages, the theme uses a larger image size, and uses JavaScript to add a CSS class for images over 1272px in width, which is used to style the images larger than the content. You can see an example of that here:
https://espieddemo.wordpress.com/portfolio/chrome-for-ios7-2/
The special class is being applied to self-hosted sites running Photon, but the image is not displaying at the correct size.
Steps to reproduce the issue
On a self-hosted, non-local site, apply the Espied theme.
Make sure Jetpack is installed. Under Jetpack > Settings, turn off "Speed up images and photos".
Create a Portfolio Project, and insert an image larger than 1272px wide. Make sure to set the image is set to display at the 'Custom' or 'Full Size'.
Publish the project, and view on the front end. You'll see a larger image:
The output for the image will look something like:
<img data-attachment-id="21" data-permalink="http://www.testsite.com/portfolio/project-1/photo-1416339306562-f3d12fefd36f/" data-orig-file="http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg" data-orig-size="4000,3000" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="photo-1416339306562-f3d12fefd36f" data-image-description="" data-medium-file="http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-300x225.jpeg" data-large-file="http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-1024x768.jpeg" class="alignnone size-full wp-image-21 size-big" src="http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg" alt="" width="4000" height="3000" srcset="http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg 4000w, http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-300x225.jpeg 300w, http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-768x576.jpeg 768w, http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-1024x768.jpeg 1024w, http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-840x630.jpeg 840w, http://www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f-480x360.jpeg 480w" sizes="(max-width: 4000px) 100vw, 4000px">
Go back to Jetpack > Settings, and turn on "Speed up images and photos".
View the portfolio post again.
What I expected
That the image would look the same.
What happened instead
The image displays at a smaller size. However, the JavaScript in the theme still applies the class to the image, as though it's a larger image, so it's outdented to the left:
The output for this image is:
<img data-attachment-id="21" data-permalink="http://www.testsite.com/portfolio/project-1/photo-1416339306562-f3d12fefd36f/" data-orig-file="https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?fit=4000%2C3000" data-orig-size="4000,3000" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="photo-1416339306562-f3d12fefd36f" data-image-description="" data-medium-file="https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?fit=300%2C225" data-large-file="https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?fit=1024%2C768" class="alignnone size-full wp-image-21 size-big" src="https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?resize=1272%2C954" alt="" srcset="https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?w=4000 4000w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?resize=300%2C225 300w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?resize=768%2C576 768w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?resize=1024%2C768 1024w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?resize=840%2C630 840w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?resize=480%2C360 480w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?w=2544 2544w, https://i1.wp.com/www.testsite.com/wp-content/uploads/2017/06/photo-1416339306562-f3d12fefd36f.jpeg?w=3816 3816w" sizes="(max-width: 1272px) 100vw, 1272px" width="552" height="414">
The problematic bit is the
width="552" height="414"
at the end.I've experimented with this a bit. Adjusting the
$content_width
for the theme does not affect this. However, changing the width of the containing element via CSS does.For example, if I remove this from the style.css, the image will display at full width:
It will still include an inline width attribute, but it will use the width set by the theme's
$content_width
.If I change the width to 800, the
width
attribute will match that. If I change it to something higher than the image, it'll stick to the width set by the$content_width
.In Espied, the issue seems to be that Photon gets the image's width on load, and uses that; then the theme's JavaScript checks to see the actual image size (which is still large, even though a
width
attribute is being used to make it look smaller) and adds the class used by the theme for large images. Then the styles are applied, but the image stays small.I was wondering why the size is being inserted? It doesn't actually change the image's physical size (which uses the
$content_width
), just the size it displays at. If it's to make sure it doesn't display too large, themes should be doing that via amax-width
in the CSS.It may be possible to strip out the
height
andwidth
attributes in the theme via JavaScript, but that seemed a bit hacky. I wanted to double-check why Photon's inserting the sizes first.