Welcome Guest, Not a member yet? Register   Sign In
how to display an image?
#1

[eluser]Wondering Coder[/eluser]
hi to all CI community,

right now I'm able to save the file_name of the image i've uploaded in my database table but what I want to do now is how can I display the image in my view(just like those in resume photo). Do I need some kind of CI library here?
#2

[eluser]ramm[/eluser]
NO

You just need to show the image like any other image, only using the value from database:
Code:
<img src="path/to/uploads/&lt;?php echo $file_name; ?&gt;" alt="You image description" />
#3

[eluser]R_Nelson[/eluser]
I have a question for the original poster i've been trying to do the same thing how do you get the file name so store it in the DB?
#4

[eluser]ramm[/eluser]
http://ellislab.com/codeigniter/user-gui...ading.html

At the end of that page where says: $this->upload->data()

There you have an array with all the information of the uploaded file.
#5

[eluser]InsiteFX[/eluser]
Load the CodeIgniter HTML_Helper.
Code:
$data = array();

$data['file_name'] = $file_name;

$this->load->vars($data);
$this->load->view('your_view');

// In your view.
&lt;?php echo img('uploads/'.$file_name);?&gt;
// gives <img src="http://site.com/uploads/picture.ext" />

InsiteFX
#6

[eluser]Wondering Coder[/eluser]
@R_Nelson

you just need to get the file_name of the image you wish to store in the db.

you can see my code in this link: http://ellislab.com/forums/viewthread/184167/




Theme © iAndrew 2016 - Forum software by © MyBB