Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photon + Portfolio: srcset only returns very small images #3080

Closed
kraftbj opened this issue Nov 29, 2015 · 4 comments · Fixed by #3084
Closed

Photon + Portfolio: srcset only returns very small images #3080

kraftbj opened this issue Nov 29, 2015 · 4 comments · Fixed by #3084
Assignees
Labels
[Feature] Custom Content Types Custom post or content types (usually for testimonials and portfolios) and their settings. [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Type] Bug When a feature is broken and / or not performing as intended
Milestone

Comments

@kraftbj
Copy link
Contributor

kraftbj commented Nov 29, 2015

HTML without Photon:

<img src="https://kraft.im/uploads/2015/01/365brew.jpeg" class="attachment-large size-large wp-post-image" alt="365brew screenshot 1/2015" srcset="https://kraft.im/uploads/2015/01/365brew-400x267.jpeg 400w, https://kraft.im/uploads/2015/01/365brew.jpeg 600w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" height="400" width="600">

HTML with Photon

<img src="https://i2.wp.com/kraft.im/uploads/2015/01/365brew.jpeg?fit=700%2C700" class="attachment-large size-large wp-post-image" alt="365brew screenshot 1/2015" srcset="https://i2.wp.com/kraft.im/uploads/2015/01/365brew.jpeg?resize=150%2C150 150w, https://i2.wp.com/kraft.im/uploads/2015/01/365brew.jpeg?resize=100%2C100 100w, https://i2.wp.com/kraft.im/uploads/2015/01/365brew.jpeg?resize=50%2C50 50w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" height="700" width="700">

No Photon:
screen shot 2015-11-29 at 10 17 04

Photon:

screen shot 2015-11-29 at 10 16 43

Steps to reproduce:
0. Photon + Custom Content Types active, Portfolio active

  1. Create a portfolio post with a smaller feature image. Example:
    jetpack
  2. Add the [portfolio] shortcode to a page.

Expected: A clear image displayed.
Actual: Blurry image.

A quick look using the above image, Core provides a 300w example (using Twenty Fifteen) while Photon gives a 150w and a 50w. Haven't looked more yet.

@kraftbj kraftbj added [Type] Bug When a feature is broken and / or not performing as intended [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Feature] Custom Content Types Custom post or content types (usually for testimonials and portfolios) and their settings. labels Nov 29, 2015
@kraftbj kraftbj added this to the 3.8.1 milestone Nov 29, 2015
@dereksmart
Copy link
Member

Where can I see this image live?

Can you provide exact setup (theme) and steps you took to get there (did you upload new image or use an existing one from the media lib).

I can't reproduce it in default 2015, using the same image you provided.
http://dereksmart.wpsandbox.me/portfolio-shortcode/

@kraftbj
Copy link
Contributor Author

kraftbj commented Nov 30, 2015

https://kraftbj.wpsandbox.me/port-test/

Theme: Twenty Fifteen
Modules active: Photon, Tiled Galleries, Custom Content Types

I activated portfolio, assigned the image above as the feature image of a new portfolio piece, added the shortcode.

I activated SSO and set you up with an account at https://kraftbj.wpsandbox.me/wp-admin/ so you can poke around there too.

Also can see live at https://kraft.im/about/ (Twenty Sixteen).

@kraftbj
Copy link
Contributor Author

kraftbj commented Nov 30, 2015

@dereksmart On your page, I'm not seeing any srcset for the portfolio image. Can you double-check that you're on latest trunk/master? I up/pull both to confirm I'm not seeing anything already fixed and still happening on both my sandbox and my prod site.

@kraftbj
Copy link
Contributor Author

kraftbj commented Dec 1, 2015

For the future record, the issue was the way our image_downsize filter handled situations where the requested image size was larger than the full-size of the image. The return included the requested size, not the actual size of the image, which led to Core's srcset processing to be a bit confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Custom Content Types Custom post or content types (usually for testimonials and portfolios) and their settings. [Feature] Photon aka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants