Tiffany
Tiffany

Reputation: 57

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?

Upvotes: 3

Views: 2331

Answers (1)

Jens A. Koch
Jens A. Koch

Reputation: 41737

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.

Upvotes: 3

Related Questions