CodeIgniter Forums
To put the appropiate photo in the profile session. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: To put the appropiate photo in the profile session. (/thread-55231.html)



To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]masentinel900[/eluser]
Hello Everybody.
I´m managing a session module for the users in my Website, now I need that each one user have your profile picture. For this there a space in where the user may upload your photo.

Until This point all right, The route is upload to a table in a DB. No problem.

I want to show the picture like this:

Here I declare the route in a variable in a controller file.
Code:
$data['ruta'] = $_SERVER['DOCUMENT_ROOT'].'/';
$data['rutaimagen'] = $session_data['rutaimagen'];
"The second variable is the called to the table in the database, This is the container of the route from the codeigniter folder"

This is the Code in the HTML file for may to show the picture.
Code:
<img src="&lt;?php echo $ruta,$rutaimagen; ?&gt;">

When I to call the php variable show it good, but when I intrduce in the src="" of the img tag don´t show nothing..




To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]j0se[/eluser]
To join strings or "vars" need to use .

Example:
Code:
<img src="&lt;?php echo $ruta . $rutaimagen ;?&gt;">
or
Code:
<img src="&lt;?=$ruta . $rutaimagen ?&gt;">



To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]masentinel900[/eluser]
Hello, Thanks by your reponse.

The "," in the join string put it bad but already I fix it.

I tested the due ways that you tell me and nothing works, you see my route "C:/Program Files (x86)/PostgreSQL/EnterpriseDB-ApachePHP/apache/www/V1/profileFolder/tibby.jpg" ..

I don´t know why not show the picture with this variables in the src...


To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]j0se[/eluser]
You can't use $_SERVER['DOCUMENT_ROOT'] you must use "relative path"

If absolute path is “C:/Program Files (x86)/PostgreSQL/EnterpriseDB-ApachePHP/apache/www/V1/profileFolder/tibby.jpg” (if root of web is in www --- http://yourserver.com/V1/profileFolder/)
you must use "/V1/profileFolder/" for $data['ruta']



To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]masentinel900[/eluser]
My friend don´t works,I Put this but neither works.. I don´t know why..


To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]j0se[/eluser]
if you go to:

http://server/V1/profileFolder/tibby.jpg

or

http://server/profileFolder/tibby.jpg


you see the pic??


To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]masentinel900[/eluser]
When I put the route "http://localhost:8080/V1/profilefolder/tibby.jpg" I see the photo..


To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]j0se[/eluser]
If
Code:
$data['rutaimagen'] = $session_data['rutaimagen'];
is the filename of the pic...

Code:
$path = "/V1/profileFolder/";
<img src="&lt;?=$path . $data['rutaimagen']?&gt;">

If not work put the code or the url where I can see it ...



To put the appropiate photo in the profile session. - El Forum - 10-16-2012

[eluser]masentinel900[/eluser]
But I have a question, I should to name all the route..
So with "C:/Program Files (x86)/PostgreSQL/EnterpriseDB-ApachePHP/apache/" or only I should to name next of the folder www of my localhost..