Okay, I know this might seem a little off but I am trying to achieve a solution where an image URL is used only when the image URL is valid and exists.
$imglink = URL . 'public/uploads/profile/' . $value['image']; //valid to be used if image exists
$defaultLink = URL . 'public/images/profile-img.jpg'; // To be used if $imglink is not available
What I have tried is:
$loki = $imglink ? $imglink : $defaultLink;
$imageURL = "<img src='$loki' width='120px' height='120px' style='border-radius: 50%; border: 2px solid #edf9f3'/>";
ALSO Tried this:
$imageURL = "<img src='<?php echo $imglink ? $imglink : $defaultLink />' width='120px' height='120px' style='border-radius: 50%; border: 2px solid #edf9f3'/>";
I have tried using different approaches but it isn't working. Also, this is being done in a Codeigniter Controller file.