Skip to content Skip to sidebar Skip to footer

How To Load Image From Network Path Via Php

I am trying to load an image from a network path into my php file. Here is my code:

Solution 1:

Try thins.

Change this,

echo'<img src='.$image_src.' alt="No Image">';

To this,

echo"<img src=".$image_src." alt='No Image'>";

Solution 2:

Make sure the client that access the generated HTML page have access to this image. In fact the image on the HTML img tag is not retrieve by PHP but by your browser following the URL you provided in the attribute src. So if the browser can't access the URL, the image won't be loaded.

Solution 3:

USE $_SERVER["DOCUMENT_ROOT"] to get the correct path of the server to get the Image.

corrected

echo "<img src=".$image_src." alt='No Image'>";

<?php$image_src="//SERVER/2 MESHES/80 - RailClone Lib/Geländer/thumbnails/Geländer 2.jpg";
    echo"<img src=".$image_src." alt='No Image'>";

?>

Post a Comment for "How To Load Image From Network Path Via Php"