How does PHP display images on the server?

Source: Internet
Author: User
I want to display all the images in the upload directory in my server browser. how can I get this code? I saw an example on the Internet, but I wouldn't use the second foreach to write anything? I have no pages, and I have two images {code...}. I want to display all the images in the upload directory in my server browser. how can I get this code?
I saw an example on the Internet, but I wouldn't use the second foreach to write anything? I have no pages. there are only two images in it.

$ Img = array ('GIF', 'PNG ', 'jpg'); // suffix of all images $ dir = 'data /'; // folder name $ pic = array (); foreach ($ img as $ k => $ v) {$ pattern = $ dir. '*. '. $ v; $ all = glob ($ pattern); $ pic = array_merge ($ pic, $ all);} foreach ($ pic as $ p) {// code displayed on the branch page}

Reply content:

I want to display all the images in the upload directory in my server browser. how can I get this code?
I saw an example on the Internet, but I wouldn't use the second foreach to write anything? I have no pages. there are only two images in it.

$ Img = array ('GIF', 'PNG ', 'jpg'); // suffix of all images $ dir = 'data /'; // folder name $ pic = array (); foreach ($ img as $ k => $ v) {$ pattern = $ dir. '*. '. $ v; $ all = glob ($ pattern); $ pic = array_merge ($ pic, $ all);} foreach ($ pic as $ p) {// code displayed on the branch page}

Make a soft link to your image folder to a web-accessible directory. Then you can write a web page to display them cyclically.
If your directory can be accessed, you can write HTML output in your existing code segment.

Do you want the following effects:
System ("path of the image browsing program ")
......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.