Comments (5)
After some testing on the latest library version, I can confirm that this is no longer an issue. Please feel free to comment back if, for whatever reason, this is still not the case.
from imgix-php.
@rubas I'm a little bit confused--you appear to be using rawurlencode()
in both examples you've provided here. You're saying the top version doesn't work even though you're raw-encoding the $path
variable on line 6?
Also, which version of the library are you using? As of version 1.2.1, if you pass true
in as the third argument for the createURL()
function, the given path will automatically be passed through rawurlencode()
. You can see the implementation in PR #27. Does this solve your issue?
from imgix-php.
@jayeb sorry for the copy/paste typo in the example. I corrected them above.
It doesn't work if I don't manually encode the path before handing it over.
The PR #27 parameter is not helping as it seems it is only applied if the path starts with http?!
from imgix-php.
Ahh okay, I think I understand the issue now. The logic behind when and how to encode paths in our libraries isn't as straightforward as it seems it should be, and we're clearly not doing it correctly in all of our libraries. The correct logic is:
- All paths are expected to be passed in unencoded
- If the path matches
/^https?:\/\//
, it should be fully encoded, slashes and all (this is for web proxy sources, where the image path is actually a fully-qualified URL). From my research (my PHP-knowledge is a bit rusty), it seems likerawurlencode()
is always preferred tourlencode()
. - If the path does not match
/^https?:\/\//
, it should be semi-encoded--encode illegal URL characters, leave everything else alone. There doesn't seem to be a native PHP function to handle this, so we'll need to do some jiggery-pokery to make this work.
I'm gonna put together a PR to iron this out once and for all--stay tuned.
from imgix-php.
rawurlencode
should be used as it follows RFC 3986.
The problem is (as I understand it), that you are using the unencoded path to create the signature but the browser is handling those Umlaut automatically in background and calls Imgix with an encoded path. This means that the generated signature will not match.
Why are you not always encoding the path? Just make sure that /
and maybe :
is not encoded. (Either split with those delimeter or replace %2F
and %3A
afterwards).
from imgix-php.
Related Issues (20)
- build: don't commit the `composer.lock` file HOT 3
- Add option to exclude library param HOT 5
- Mangled src URLs HOT 1
- unable to add imgix-php files to git HOT 4
- Building a URL with multi-dimensional array HOT 2
- Describe an easy example for purge images in PHP HOT 6
- Regression in version 1.2 HOT 1
- Drupal 7 with Imgix HOT 2
- encoding URLs incorrectly for characters "(" and ")" HOT 4
- Multi-line Text & Overlays with the Typesetting Endpoint HOT 1
- Image width and height on-the-fly HOT 4
- Tag a new release with latest changes in master HOT 1
- h-parameter scaling in createSrcSet HOT 6
- feat: optionally disable path encoding HOT 3
- feat: customize variable qualities
- feat: customize target Device Pixel Ratios
- Release a new major version (v4.0) with PHP 8.0+ support only HOT 5
- Add a coding style, with an automatic formatter HOT 4
- Suggestion: Open development branch for accepting PRs to next major version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgix-php.