I'm trying to display an image but it doesn't show anything although I got the correct URL for the image in my server. Here's my current progress/Output:
PHP Snippet Code
$Report_ID = 51;
$Retrieval_Image_Query = mysqli_query($Connection, "SELECT Image_Name,Original_Image_Directory,RGB_Image_Directory FROM Report_Image WHERE Report_ID = $Report_ID");
//REMOVES THE FOLLOWING WORDS IN THE STRING BECAUSE IT RESULTS IN A WRONG URL
$Result = mysqli_fetch_object($Retrieval_Image_Query);
$Temp_Orig_Image = str_replace("/home/u871055686/domains/", '', $Result->Original_Image_Directory);
$Temp_RGB_Image = str_replace("/home/u871055686/domains/", '', $Result->RGB_Image_Directory);
$Final_String["Original_Image_Directory"] = preg_replace("/\bpublic_html\b/", '', $Temp_Orig_Image);
$Final_String["RGB_Image_Directory"] = preg_replace("/\bpublic_html\b/", '', $Temp_RGB_Image);
$Final_String["Image_Name"] = $Result->Image_Name;
?>
<img src = "<?php echo $Final_String["Original_Image_Directory"]; ?>" width = "250" height = "250" alt = "Working"/>
<?php
echo "<pre>";
var_dump($Final_String);
echo "</pre><br>";
echo json_encode($Final_String);
It outputs this URL: fireoutph.com//Report_Images/Orig_Nov_2,_2018_9:33:20_PM.png
But when I tried to open that link in my web browser (google chrome) it shows me the image file with no problem. Notice the double slash in the URL.
QUESTION
What might be the problem if there's no problem in data retrieval of image path and file type? and How can I display the image successfully?
Add http://
before the image URL:
http://fireoutph.com//Report_Images/Orig_Nov_2,_2018_9:33:20_PM.png