M
M
mihalich2010-10-27 11:02:58
PHP
mihalich, 2010-10-27 11:02:58

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

6 answer(s)
V
Vladimir Chernyshev, 2010-10-27
@VolCh

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

I
ID175055, 2010-10-27
@ID175055

This begs the question: Why? .. Nginx produces images A by subject much better
. Rewrite our everything.

S
Sererator, 2010-10-27
@Serator

In php, you collect an image, set the necessary headers and give it away. What is the problem?

E
Eugene, 2010-10-27
@Nc_Soft

Look at the nginx config on the old server if possible.

A
artoodetoo, 2010-10-27
@artoodetoo

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.

T
Thomas, 2010-10-27
@Thomas

Look towards timthumb
begenote.ru/php/9/ There
is already caching of already compressed images.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question