Welcome Guest, Not a member yet? Register   Sign In
To put the appropiate photo in the profile session.
#1

[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..

#2

[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;">
#3

[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...
#4

[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']
#5

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

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

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

or

http://server/profileFolder/tibby.jpg


you see the pic??
#7

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

[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 ...
#9

[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..




Theme © iAndrew 2016 - Forum software by © MyBB