Is there any way to display an BLOB image from database ?
I've tried this but not working:
<?print'<img src="data:image/jpeg;base64,. base64_encode($img["Imag"])"> '; ?>
echo '<img src="data:image/jpeg;base64,'.base64_encode( $img['Imag'] ).'"/>';
Try this
There is problem in your concatination also don't use print in this scenario use echo.
echo '<img src="data:image/jpeg;base64,'. $img['Imag'] .'"/>';
OR
echo '<img src='.base64_encode ($img ["Imag"].' />';
Related
Image path is getting stored in the database and file is getting uploaded in the upload path but the image is not displaying in the tabular format.
Here is the code for the view:
<tbody>
<?php
$query = $this->db->query("SELECT * FROM banner_mgmt LIMIT 1");
// $url = base_url().
foreach ($query->result() as $row)
{
echo "<tr>";
echo "<td>$row->id</td>";
echo "<td>$row->banner_name</td>";
echo "<td>".'<img src="base_url().$row->banner_image" style="height:150px; width:150px;" alt="not found">'."</td>";
echo "<td>$row->banner_image</td>";
echo "</tr>";
}
?>
</tbody>
Assuming that base_url().$row->banner_image does actually result in a correct path/image name...
You need to check your string concatenation.
What you have... (overly complicated)
echo "<td>".'<img src="base_url().$row->banner_image" style="height:150px; width:150px;" alt="not found">'."</td>";
What you should have...
echo '<td><img src ="'.base_url().$row->banner_image.'" style="height:150px; width:150px;" alt="not found"></td>';
You need to think about how you want the string to turn out, which helps you determine when and where to use ', " and . properly.
Here I am wrapping the string using ' (single quotes), which allows me to use " (double quotes) in the HTML properties without much effort.
Read up on how to use base_url() in the Codeigniter user guide...
So you could have
echo '<td><img src ="'.base_url($row->banner_image).'" style="height:150px; width:150px;" alt="not found"></td>';
You could even use " (double quotes) which evaluate php but you will need to escape any 'internal' double quotes you want to display.
echo "<td><img src =\"base_url($row->banner_image)\" style=\"height:150px; width:150px;\" alt=\"not found\"></td>";
So, you need to read the answer at What is the difference between single-quoted and double-quoted strings in PHP?
I have multiple HTML files, like this:
</HEAD><BODY><B> something <BR>bla bla bla
<A HREF=http://www.exemple.com>http://exemple.com</A> - site bla
bla bla bla (test n°15336) <BR><BR><BR><HR>
I want to make it like this:
</HEAD><BODY><B> something <BR> <BR><BR><BR><HR>
Nothing works: sed, grep, awk... any suggestions?
I am back to post the solution after long search
first i need to parsing my html file so i have create a php code that finish this task very simple and useful
<?php
define('TEMPLATE', __DIR__ . DIRECTORY_SEPARATOR . 'test.html');
$template = file_get_contents(TEMPLATE);
$st='';
$template = preg_replace('#(<\/A>).*?(<BR>)#is', $st, $template);
$template = preg_replace('#(<BR>).*?(<BR>)#is', $st, $template);
$file = 'output.html';
file_put_contents($file, $template);
?>
Et Voila!!!!!! XD
Thank you for the Reputation and thank you again for no Helping .
Trying to save a csv file on my server with codeigniter.
my syntax is:
$this->load->dbutil();
$query = $this->db->query("SELECT id,customeraccount,band FROM Customer_Bands");
$delimiter = ',';
$newline = "<br>";
echo $this->dbutil->csv_from_result($query, $delimiter, $newline);
if ( ! write_file(base_url().'/application/authorizations/test.csv', $this->dbutil->csv_from_result($query, $delimiter, $newline)))
{
echo 'Unable to write the file';
}
else
{
echo 'File written!';
}
This is rough right now but want to get functionality working first.
Two issues.
Firstly the echo $this->dbutil->csv_from_result($query, $delimiter, $newline); outputs to my view correctly but each field is inside "", how can I remove these?
Secondly, the file is not writing to my server.
base_url() is my codeigniter root folder then inside applications I have created a folder named authorizations so base_url()/application/authorizations
This currently fails and echos 'Unable to write the file'
Thanks in advance
Parse error: syntax error, unexpected T_ECHO in
$options=array('startOffset' => 0,)
echo JHtml::_('tabs.start', '', $options);
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHDETAILS'), 'panel1' );
echo $this->loadTemplate('matchdetails');
echo JHtml::_('tabs.panel', JText::_('TABS_SCOREDETAILS'), 'panel2' );
echo $this->loadTemplate('scoredetails');
echo JHtml::_('tabs.panel', JText::_('TABS_ALTDECISION'), 'panel3' );
echo $this->loadTemplate('altdecision');
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHREPORT'), 'panel4' );
echo $this->loadTemplate('matchreport');
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHPREVIEW'), 'panel5' );
echo $this->loadTemplate('matchpreview');
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHRELATION'), 'panel6' );
echo $this->loadTemplate('matchrelation');
echo JHtml::_('tabs.panel', JText::_('TABS_EXTENDED'), 'panel7' );
echo $this->loadTemplate('matchextended');
echo JHtml::_('tabs.end');
Thanks for the answers
Firstly JPane was deprecated in Joomla 2.5 - so whilst its available to use there you should be using it. For a 2.5/3.1 component/site you should use JHtml Tabs. See the docs page here for instructions on how to use it.
In your specific case something like:
$options=array('startOffset' => 9,);
echo JHtml::_('tabs.start', '', $options);
echo JHtml::_('tabs.panel', JText::_('COM_JOOMLEAGUE_EDIT_EVENTS_EDIT_HOME_SUBST'), '');
echo $this->loadTemplate('edit_home_substitution');
echo JHtml::_('tabs.panel', JText::_('COM_JOOMLEAGUE_EDIT_EVENTS_EDIT_HOME_PLAYER'), '');
echo $this->loadTemplate('edit_home_player');
echo JHtml::_('tabs.end');
Note also that bootstrap pane's exist as of Joomla 3.0 (and will probably replace JHtml tabs in Joomla 4.0 (still a long way away) which are used in a more similar way to JPane - however these aren't particularly well documented yet - So I'd advise sticking with JHtml tabs for now
My MediaWiki cannot get the path of my live web server. Here is the code:
$script = $_SERVER['SCRIPT_NAME'];
$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/';
$path = str_replace( '//', '/', $path );
$ext = pathinfo( $script, PATHINFO_EXTENSION );
echo "Please enter";
The localhostwebserver displays the echo as: Please enter,
but the live server displays the echo as Please enter
How is that possible? Need help!
If you need the url of the current page in php, I can recommend this script. I have used it successfully for years.