Home  >  Article  >  Backend Development  >  How is a picture with a structure like Yidianxin realized?

How is a picture with a structure like Yidianxin realized?

WBOY
WBOYOriginal
2016-09-01 00:20:12904browse

Such as the title: My website also collects articles. How do I implement such a picture format?
To put it simply, how to save the collected pictures? What is the logic of image.php displayed on the front end?
How is a picture with a structure like Yidianxin realized?

Maybe my expression is not clear enough. What I want is that the server already has pictures, but on the front end I also want to display pictures in the form of image.php?url=xxxxxxx, so I want to ask what the logic of this image.php is. ?

Reply content:

Such as the title: My website also collects articles. How do I implement such a picture format?
To put it simply, how to save the collected pictures? What is the logic of image.php displayed on the front end?
How is a picture with a structure like Yidianxin realized?

Maybe my expression is not clear enough. What I want is that the server already has pictures, but on the front end I also want to display pictures in the form of image.php?url=xxxxxxx, so I want to ask what the logic of this image.php is. ?

First, each picture needs its own id, such as hajhdjs
Then url?id=hajhdjs
The background gets the corresponding picture based on the id, and then uses the
imagepng() function to output the picture

It’s equivalent to dynamically outputting the picture, and the following series of parameters locate the position of the picture.
Many ideas:

  1. Directly use nginx to intercept and redirect parameters to other urls

  2. php gets the local path image based on the parameters and outputs

1. The backend outputs the image file according to the parameters
2. Set the response header Content-Type: image/png

PHP Set MIME Types and you can echo output the image content.

The server (php) receives the parameters, gets the characters related to the real link of the picture, and finally splices out the complete link url, and then echo file_get_contents(url)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn