2016-04-06 3 views
0

Cake \ ORM \ TableRegistryを使用する。cakephp3を使用してアップロードした後にデータベースから画像を取得する。

$ websites => TableRegistry :: get( 'Websites');

$クエリ=> $ websites->)(見つける - >順([ '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']); 

しかし、どのように画像を表示するために、cakephp3でそれをすることができません。 ?>

答えて

0

CakePHPの3においてNO任意の大きな違いがあり、コード

<?php foreach ($websites as $websites): ?> 
    <?= $this->Html->image('websites/'.$websites->image) ?> 
<?php endforeach; ?> 
+0

以下のようにまだ私がアップロードされた画像を見るカントのように、それは簡単です。 – distromob

+0

画像をアップロードしましたか?試したコードを追加してください。 –

+0

は... https://gist.github.com/distromob/911e9f1bc4030de855c1c3d7f3876fe2 – distromob

関連する問題