Issue
use Cake\ORM\TableRegistry;
$websites => TableRegistry::get('Websites');
$query => $websites->find()->order(['creation_date' => 'DESC']);
echo "<table>"; echo"<tr> <td>Cover Image</td> <td>Company Name</td> <td>Date Added</td> </tr>"; foreach ($query as $row) { echo"<tr> <td>".$row['Website']['image']."</td> <td>".$row->company."</td <td>".$row->creation_date."</td> </tr>"; } echo"</table>"; ?>
I remember this code in cakephp2 and display the images path "app/webroot/img/websites/"
<?php echo $this->Html->image('websites/' . $row['Website']['image']);
But how to do it in cakephp3 , to display the image. ?>
Solution
You seem to not know your real problem. Your question seems to be of someone struggling with the right HTML code to upload images. For that you just have to give to that uploading field in database table columna varchar type and then in the view where to upload the image from a file type to that field. Something like:
<div class="form-group">
<?php
echo $this->Form->input('your_column_name', [ 'type' => 'file']);
?>
</Div>
But if your question is about not being able to retrieve or send to index.ctp or to a frontend view the uploaded image, then your solution is here: How to retrieve in cakephp3.7 the name as string of an image uploaded trough a form with blob column into a mysql database?
Answered By - Himmels DJ
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.