简体   繁体   中英

How to display images from a network using PHP

I have a local intranet webpage hosted @ let's say, 192.168.20.1, and I have a bunch of images and videos @ 192.168.20.5

Is it possible to display those images/videos using and tags using PHP?

What I did before is to make a temporary copy of those network files in the webserver and then display it but some of the files, especially, the videos are too large and consumes a lot of time copying...

Is this possible in PHP? Thanks in advance

Also, the network folder has credentials (username/password)... thanks

Yes, use the IP address in the tags, for example:

<?php $otherServer = 'http://192.168.20.5'; ?>

<img src="<?php echo $otherServer ?>/images/image1.jpg">

Using a variable will make it much easier to maintain the code.

You can build some PHP APIS in media host with Authentication functionary and return media file URL directly. And the credentials can hold in cookies when loggin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM