Answer the question
In order to leave comments, you need to log in
Returning images with GET parameters not using nginx, but php
Those. support of our dedicated server for rent (under their management) stubbornly fools, in response to the question:
Is it possible to make image requests with GET parameters be given to php, and not nginx?
« www.site.ru/upload/articles/58fa0825907dc76e67e8cb1150a7ac36.jpg?w=100&h=100&strict »
At the same time, this feature works on our old server, which was administrated by a freelancer (but it disappeared).
Where to poke a finger tech support?
Thanks
Answer the question
In order to leave comments, you need to log in
Can. Assign the jpg extension as a php handler, for example (then you need to store the text of the script in jpg :) ).
Or, as mentioned above, rewrite/redirect: from a GET /upload/articles/58fa0825907dc76e67e8cb1150a7ac36.jpg?w=100&h=100&strict request to make a GET /superscript.php?path=/upload/articles/58fa0825907dc76e67e8cb1150a7ac36.jpg&w=100&stricth1
request , if there is a task of scaling, I would go the other way:
- when requesting, nginx checks whether there is a file /upload/articles/58fa0825907dc76e67e8cb1150a7ac36_100х100_strict.jpg
- if not, then calls php to generate
- gives the file (it is already there, if there were no fatal errors)
Pros: php is called only once, on the first call
Cons: Requires more disk space; when changing the original file, you need to delete the generated
This begs the question: Why? .. Nginx produces images A by subject much better
. Rewrite our everything.
In php, you collect an image, set the necessary headers and give it away. What is the problem?
If I understand you correctly, pictures do not physically exist, but must be generated by a script (according to the given GET parameters). In this case, read about the nginx try_files directive - it checks for the existence of a file and indicates where to go if it does not exist.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question