I have been using some code from a forum discussion (linked here) viewtopic.php?f=8&t=3840&p=14613&hilit= ... 4da#p14613 between pböttcher and bruceholt on uploading a user logo. I have that part working. But there is an additional part to the code that places a default logo image if the user does not upload one of their own. I can't seem to get that part of the code working. So as usual, I'm reaching out for help from the forum. Which by the way, is the best tech forum on the web in my humble opinion. I would love to have this functionality in my app. Please help if you can.
When a user uploads a logo image I can get it to show in my report. But if they don't upload a logo image I cannot get the default image to show. there are screen shots below:
LOGO Printing Default LOGO not printing: Here is the code I have been using:
Code: Select all
<?php
$image=sqlValue("SELECT logo FROM " . get_sql_from('company', false, true));
$path="../images/";
echo '<img src="'.$path.$image.'" id="company_image" style="max-width: 100px;">';
/*var_dump($path);*/
/* *********** PLACE DEFAULT LOGO IF NO CLIENT LOGO UPLOADED ******* */
if(file_exists($image=sqlValue("SELECT logo FROM " . get_sql_from('company', false, true)))) {
$path="../images/";
echo '<img src="'.$path.$image.'" id="company_image" style="max-width: 100px; max-height: 50px; background-color: transparent">';
}
else {
$image = 'default.jpg';
}
/*var_dump($image);*/
?>