Home > Backend Development > PHP Tutorial > How does PHP display images on the server side?

How does PHP display images on the server side?

WBOY
Release: 2016-08-18 09:16:25
Original
1410 people have browsed it

I want to display all the images in the upload directory on my server-side browser. How do I get this code?
I saw an example on the Internet, but I can’t use it. What is written in the second foreach? Mine doesn’t have pagination. There are only two pictures in it

<code>$img = array('gif','png','jpg');//所有图片的后缀名
$dir = 'data/';//文件夹名称
$pic = array();
foreach($img as $k=>$v)
{
    $pattern = $dir.'*.'.$v;
    $all = glob($pattern);
    $pic = array_merge($pic,$all);
}
foreach($pic as $p)
{
//分行分页显示代码
}</code>
Copy after login
Copy after login

Reply content:

I want to display all the images in the upload directory on my server-side browser. How do I get this code?
I saw an example on the Internet, but I can’t use it. What is written in the second foreach? Mine doesn’t have pagination. There are only two pictures in it

<code>$img = array('gif','png','jpg');//所有图片的后缀名
$dir = 'data/';//文件夹名称
$pic = array();
foreach($img as $k=>$v)
{
    $pattern = $dir.'*.'.$v;
    $all = glob($pattern);
    $pic = array_merge($pic,$all);
}
foreach($pic as $p)
{
//分行分页显示代码
}</code>
Copy after login
Copy after login

Make a soft link to your picture folder to a directory that can be accessed by the web. Then you can write a web page loop output to display them. If your directory itself can be accessed, then just write HTML output in your existing code segment.

Is the effect you want to be:

system("Path of the picture browser program, path of the picture")
......

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template