mardi 22 mai 2018

HTML PHP: show default IMG if the specified one does not exist using pictures of network location

I think this was already answered but i'm trying to show a picture based on a variable. If the Image does not exist it should show the default IMG. The problem is that the images are both not being displayed. The images are stored on a server accessible from the network. The images have $IDnr.jpg as name.

<?php
  $filename="\\Network-server\map\map\map\map\<?php echo $IDnr; ?>.jpg";
  if(is_readable($filename)){
     $fileToShow=$filename;
  }else{
    $fileToShow="\\Network-server\map\map\map\map\defaultIMG.jpg";
  }
    echo '<img class="imageclass" src="<?php echo $fileToShow; ?>"/>';
?>

Aucun commentaire:

Enregistrer un commentaire