Code Monkey home page Code Monkey logo

Comments (5)

derekeder avatar derekeder commented on July 19, 2024

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.

from askthem.

walter avatar walter commented on July 19, 2024

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?

from askthem.

derekeder avatar derekeder commented on July 19, 2024

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

from askthem.

walter avatar walter commented on July 19, 2024

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.

from askthem.

walter avatar walter commented on July 19, 2024

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.

from askthem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.