Closed lovato closed 10 years ago
Flask-Images define the image type from the extension. It is easy to guess extension from mimetype. It is a valid use case and should work fine.
The problem with the &
happens because of some urlencoding issue in URL building, which can be fixed in Flask-Images.
This just seems like bad path/URL parsing and URL generation to me. Let me see if I can nail these both down quickly...
I've fixed this, and pushed to the PyPI as v1.1.5.
Cheers,
Mike
I've actually reverted the 1.1.5 deployment; it will be ready very shortly.
I am trying to fetch an image from GoogleMaps static api. I faced 2 problems: a) first, I had to replace '&' for '&' ... thats ok. b) I got 'key error' at this point:
(u'http://maps.googleapis.com/maps/api/staticmap?markers=color:red|-29.828736,-51', u'.150409&zoom=17&size=600x600')
It is spliting for '.', and getting the 2nd part as extension, which in this case produces an error. The used URL was:
http://imagebox.lovato.geek42.org/imgsizer/remote?w=300&u=http://maps.googleapis.com/maps/api/staticmap?markers=color:red%7C-29.828736,-51.150409%26zoom=17%26size=600x600
The error happens on line: hashlib.md5(remote_url).hexdigest() + os.path.splitext(remote_url)[1]
The solution I found was: http://imagebox.lovato.geek42.org/imgsizer/remote?w=300&u=http://maps.googleapis.com/maps/api/staticmap?markers=color:red%7C-29.828736,-51.150409%26zoom=17%26size=600x600%26ext=.jpg
By adding a ext fake parameter to my external URL, I succeeded.