Load IMG on blank

Hi,

I am having troubles with it. The first thing to say is that I am saving the images and files together. I mean that both are uploaded as files and saved in the /file/doc instead of saving the images on the /file/img folder. I do that because user will upload all type of files and I need to list all of them together.

At the moment, I am able to show the pdf file with the following code. First I get the extension of the file I have problems with image files.

$a=[path_file];
$extension = pathinfo($a, PATHINFO_EXTENSION);
$file = [path_pdf] . [path_file];
sc_alert ($file);
if ($extension == ‘pdf’){

// Header content type
header(‘Content-type: application/pdf’);
header(‘Content-Disposition: inline; filename="’ . $file . ‘"’);
header(‘Content-Transfer-Encoding: binary’);
header(‘Accept-Ranges: bytes’);
// Read the file

@readfile($file);
}else{
?> img src="<?php echo $file; ?>" /> <?Php

}

For example, this code works great:

$a=“https://i.blogs.es/aa1b9a/luna-100mpx/450_1000.jpg”;
?> img src="<?php echo $a; ?>" /> <?Php

But if I type the file saved on the server, the image doesn’t appear. The code will be following:

$a = “/opt/NetMake/v9-php73/wwwroot/scriptcase/file/doc/reclamaciones/41/docs/fondo-8.jpg”;
?> img src="<?php echo $a; ?>" /> <?Php

I am completely lost… Maybe there is a more simple way to work and show files…

Thanks in advance.

PS: in img tag < is missing