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

Questions list not showing avatars in when it should. #13

Closed
walter opened this issue Jul 26, 2013 · 5 comments
Closed

Questions list not showing avatars in when it should. #13

walter opened this issue Jul 26, 2013 · 5 comments
Labels

Comments

@walter
Copy link
Contributor

walter commented Jul 26, 2013

May be specific to federal legislator avatars.

Transferred from an ops issue..

@derekeder
Copy link
Contributor

A few things going on here, it looks like:

First http://d2xfsikitl0nz3.cloudfront.net/ being appended to an already fully pathed URL (https://github.com/opengovernment/opengovernment-app/blob/master/app/helpers/application_helper.rb#L110).

example: http://d2xfsikitl0nz3.cloudfront.net/http%3A%2F%2Fballotpedia.org%2Fwiki%2Fimages%2FVitoLopez.jpg/20/20

Second, once you fix the URL for Vito Lopez, the image path is still not quite right.

@walter
Copy link
Contributor Author

walter commented Jul 30, 2013

Here's an example format for using cloudfront successfully for an avatar (from /vt/people):

http://d2xfsikitl0nz3.cloudfront.net/http%3A%2F%2Fvermont-elections.org%2F2009-2010BioBook%2Fjpegs%2Fancel.jpg/60/60

Cloudfront is a CDN and caches the image file at the URL passed to it via the encoded URL in the path at the dimensions following the encoded URL with directories for the dimensions, i.e. the /60/60/.

So what you mentioned, to my mind, should be working when requested from Cloudfront.

The question is why is this pattern not working like the /60/60/ dimensions?

@derekeder
Copy link
Contributor

Ah yes I see that now. The image is being cached.

So then in the case of: http://oglocal.herokuapp.com/ny/questions, the source image is not found

For Vito Lopez http://d2xfsikitl0nz3.cloudfront.net/http%3A%2F%2Fballotpedia.org%2Fwiki%2Fimages%2FVitoLopez.jpg/20/20 it returns:

Expected content type image/jpeg, image/png, image/gif, image/jpg, got text/html

And the source image yields this page: http://ballotpedia.org/wiki/index.php/Images/VitoLopez.jpg/20/20

My guess is we have an outdated image URL

@walter
Copy link
Contributor Author

walter commented Jul 30, 2013

Expected content type image/jpeg, image/png, image/gif, image/jpg, got text/html

Yeah, I have seen that for s3 hosted images that didn't have their content-type set correctly in the past. CDN won't simply rely on extension.

And the source image yields this page: http://ballotpedia.org/wiki/index.php/Images/VitoLopez.jpg/20/20

So in the case of a missing image, ballotpedia.org does indeed return text/html, both for the above (which isn't what CDN would request) and for http://ballotpedia.org/wiki/index.php/Images/VitoLopez.jpg (which CDN would request).

However, we don't rely on a single source for images. In the case of state legislators, each one may have a different URL for the image, including from a different provider domain. I'm not sure that simply having a bad URL for this one particular legislator is the only problem.

When we have a good URL for a person, on this page, does the avatar appear as we expect?

So yes, it looks like the the case of Vito Lopez, our URL does appear to be outdated. What you can do is update his photo_url attribute to via the console and reload the page to check if that fixes the problem or if it persists.

@walter
Copy link
Contributor Author

walter commented Aug 1, 2013

I've verified that this IS NOT a problem for officials that don't have their images from ballotpedia.org.

I've opened another issue to deal specifically with the ballotpedia.org based avatars at #28.

@walter walter closed this as completed Aug 1, 2013
walter added a commit that referenced this issue Aug 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants