Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upImage src URLs with spaces in them don't work for fittedImage and croppedImage #221
Comments
added a commit
to srikumarks/elm-core
that referenced
this issue
Apr 21, 2015
added a commit
to srikumarks/elm-core
that referenced
this issue
Apr 21, 2015
added a commit
to srikumarks/elm-core
that referenced
this issue
Apr 26, 2015
added a commit
to srikumarks/elm-core
that referenced
this issue
Apr 26, 2015
added a commit
to srikumarks/elm-core
that referenced
this issue
Apr 26, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
srikumarks
Apr 26, 2015
Please ignore the first few commits, but the last two are perhaps worth considering. Here is what they solve -
When we provide a "src" string to tiledImage and fittedImage functions (in Graphics.Element), the functions assume that the string contains no parens (which are allowed in hrefs). For example, "helloworld).png" is a valid src value, but will break the url setting code in these two functions. Also, if we pass "hello+world.png", the intention is not clear as to whether we're referring to the local file "hello world.png" or "hello+world.png".
To make these correct, we need access to the encodeURI/decodeURI and encodeURIComponent/decodeURIComponent functions available as globals in Javascript. 2ad079b adds these to Basics and b8a94d0 adds double quotes around the "src" parameters in tiledImage and fittedImage functions.
This, I think, is a useful first step, but requires the developer to ensure correct string encodings. It will be good to have a type to track the encoding status of a string so that such errors are caught by the type system.
srikumarks
commented
Apr 26, 2015
|
Please ignore the first few commits, but the last two are perhaps worth considering. Here is what they solve - When we provide a "src" string to tiledImage and fittedImage functions (in Graphics.Element), the functions assume that the string contains no parens (which are allowed in hrefs). For example, "helloworld).png" is a valid src value, but will break the url setting code in these two functions. Also, if we pass "hello+world.png", the intention is not clear as to whether we're referring to the local file "hello world.png" or "hello+world.png". To make these correct, we need access to the encodeURI/decodeURI and encodeURIComponent/decodeURIComponent functions available as globals in Javascript. 2ad079b adds these to Basics and b8a94d0 adds double quotes around the "src" parameters in tiledImage and fittedImage functions. This, I think, is a useful first step, but requires the developer to ensure correct string encodings. It will be good to have a type to track the encoding status of a string so that such errors are caught by the type system. |
srikumarks
referenced this issue
Jul 2, 2015
Closed
Fixed #221 - Image src URLs with spaces in them don't work for fittedImage and croppedImage #222
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Jan 19, 2016
Contributor
Is this issue completely resolved by #222? Then it would make sense to close the issue itself.
|
Is this issue completely resolved by #222? Then it would make sense to close the issue itself. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Jul 6, 2016
Contributor
This issue would now belong over at https://github.com/evancz/elm-graphics.
|
This issue would now belong over at https://github.com/evancz/elm-graphics. |
srikumarks commentedApr 21, 2015
In the Graphics.Element package,
fittedImageandcroppedImagedon't work for all image URLs.For example, if an image URL is "somewhere/my cool photo.jpg", the image won't show up with
fittedImageandcroppedImage. It will, however, show up when you use "image" or "tiledImage", or if the image was named "somewhere/my-cool-photo.jpg" (without spaces).