简体   繁体   中英

retrieve image from folder in php codeigniter

imagedisplay.php(view)

  <html>
    <body>

    <h3>Your file was successfully uploaded!</h3>

    <?php  print_r($upload_data); ?>   </br>
    <?php  $str=base_url()."images/".$upload_data['file_name'] ?>  </br>
    <?php $str=str_replace('http://','',$str) ?>

    <?php echo $str; ?>  



        <img src= '$str'/>  </br>    

For echo $str; I got the string i need to display th image but when i pass it to img src.... i am not able to display it on the browswer

Is there any syntactical error or am i missing anything ...pls help?

Just a small syntax problem here. Embed PHP echo command in the HTML code, like so:

<img src="<?php echo $str; ?>"/>  </br>

or embed PHP echo short tags:

<img src="<?=$str?>"/>  </br>

In other words: insert the PHP output at the positions, where you need it as HTML content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM