[Crying] php output image problem is killing me

Jangga

Junior Member
Joined
Aug 8, 2016
Messages
196
Reaction score
11
Please guys.... I'm completely blank why this is happening

I am trying to get the image from my db which is stored like this: profile/image_name.jpg

I simply fetch the array from db & echo
But, no way. I know I'm doing it right cos I did same way in other section of my forum. In this part, the image displays but it sits at the upper left corner(see screenshot below). I don't know how to describe it so I can't do a Google search. Pls help me & tell me how to search it on Google too(English name)?

Plsssss.... I'll buy u a beer if u help
 

Attachments

  • IMG_20170104_080852_752.png
    IMG_20170104_080852_752.png
    3.4 KB · Views: 282
Not able to understand what you want to output IMG or url?
explain again
 
Not able to understand what you want to output IMG or url?
explain again

I want to output the image so that users can see it. Check screenshot and perhaps, see my first post again, thanks
 
the image part seems to be broken.

do you use an absolute or relative path to you image?
 
I don't fully get what you are trying to do, the image is missing though.
 
OP, PM me a link to your page.

You have the correct HTML tags, but the array being fetched has some issues - nothing that cannot be fixed.
 
the image part seems to be broken.

do you use an absolute or relative path to you image?

Thanks, man... I really don't know what u mean. The output code is something like this:

$details = mysql_query("SELECT * FROM master WHERE username='$delle'");
mysql_fetch_array($details);
$out=$details["image"];
echo $out;


N:B==> in db, image is stored like this: " profile/image_name.jpg "

I guess it's relative since it will automatically be appended to browserurl
E.g blackhatworld.com/profile/image_name.jpg
 
I don't fully get what you are trying to do, the image is missing though.
The image is not really missing because users with no image sees blank(which is correct). But those with image sees a tiny object at the upper left corner (see screen shot)

Mr rightfootfanatic is saying image is broken..... I'm confused
 
Thanks, man... I really don't know what u mean. The output code is something like this:

$details = mysql_query("SELECT * FROM master WHERE username='$delle'");
mysql_fetch_array($details);
$out=$details["image"];
echo $out;


N:B==> in db, image is stored like this: " profile/image_name.jpg "

I guess it's relative since it will automatically be appended to browserurl
E.g blackhatworld.com/profile/image_name.jpg

If the image is stored like this "profile/image_name.jpg" - it won't work. Because the output would be blackhatworld.comprofile/image_name.jpg

You need a preceding slash for it to be relative.
 
Thanks, man... I really don't know what u mean. The output code is something like this:

$details = mysql_query("SELECT * FROM master WHERE username='$delle'");
mysql_fetch_array($details);
$out=$details["image"];
echo $out;


N:B==> in db, image is stored like this: " profile/image_name.jpg "

I guess it's relative since it will automatically be appended to browserurl
E.g blackhatworld.com/profile/image_name.jpg

Echo '/'.$out;
Now it will append to url
 
If the image is stored like this "profile/image_name.jpg" - it won't work. Because the output would be blackhatworld.comprofile/image_name.jpg

You need a preceding slash for it to be relative.
Echo '/'.$out;
Now it will append to url


I just tried it.... It still showing me the tiny stuff at upper left corner(see screenshot on my first post). It's like there is no way out..... Php is not fair
 
I don't see what tiny spot are you talking about.
1) Provide more code (php & html)
2) Give more screenshots explaining
 
I don't see what tiny spot are you talking about.
1) Provide more code (php & html)
2) Give more screenshots explaining

See the two screenshots.. One has an arrow pointing to the tiny spot. I'll provide the code collecting the image from db & output okay?
 

Attachments

  • IMG_20170104_135238_445.jpg
    IMG_20170104_135238_445.jpg
    9 KB · Views: 208
  • IMG_20170104_135406_464.jpg
    IMG_20170104_135406_464.jpg
    5 KB · Views: 202
code to query db & output is shown below.


<?

$TAMANO_PAGE = 100;

$page = $_GET["page"];

if (!$page) {

$inicio = 0;

$page=1;

}

else {

$inicio = ($page - 1) * $TAMANO_PAGE;

}

$queryz = mysql_query("SELECT * FROM master ORDER BY id DESC limit $inicio,$TAMANO_PAGE");

while ($register = mysql_fetch_array($queryz)) {


echo "


<tr>


<td class=\"stylki go\"><font size=\"1\" face=\"verdana\">


". $register["name"] ."

</td>


<td class=\"stylki go\"><font size=\"1\" face=\"verdana\">


". $register["email"] ."

</td>


<td class=\"stylki go\"><font size=\"1\" face=\"verdana\">


". $register["subject"] ."



</font></td>

<td class=\"stylki go\"><font size=\"1\" face=\"verdana\">



". $register["comments"] ."


</font></td>



<td class=\"stylki go\"><img src='/'". $register["image"] ." border=\"0\" width=\"300\" height=\"200\"

</td>


<td class=\"stylki go\"><font size=\"1\" face=\"verdana\">



". $register["reply"] ."


</font></td>


<td class=\"stylki go\"><font size=\"1\" face=\"verdana\">";


}


?>
 
Any help forthcoming? Oh....
 
Can you post the html output being rendered.

Also run a print for the output of the code.
 
The image is not really missing because users with no image sees blank(which is correct). But those with image sees a tiny object at the upper left corner (see screen shot)

Mr rightfootfanatic is saying image is broken..... I'm confused

The image is missing/broken.

Looking at your code, try to change
PHP:
'/'". $register["image"] ."
to
PHP:
'/". $register["image"] ."'
 
this line in your code
Code:
<td class=\"stylki go\"><img src='/'". $register["image"] ." border=\"0\" width=\"300\" height=\"200\"

you're not closing the image tag. change it to this
Code:
<td class=\"stylki go\"><img src='/'". $register["image"] ." border=\"0\" width=\"300\" height=\"200\">

you could also do it this way as it makes your code easier to read (for me anyway lol)
Code:
<td class='stylki go'><img src='".$register['image']."' border='0' width='300' height='200'>

also technically by adding a slash to the start of the url you fetch from the DB you make it absolute to root

if your "profile" directory is a sub of where your php is located then you were right with no slash
if profile is found in the www root then you need to add a slash at the start.
 
The image is missing/broken.

Looking at your code, try to change
PHP:
'/'". $register["image"] ."
to
PHP:
'/". $register["image"] ."'

Tried it & no headway. #stillStuck
 
Can you post the html output being rendered.

Also run a print for the output of the code.
Ok. I used chrome & inspected the element. & the image output is okay

<img src="profile/paul k 23445667788744.jpg" border="0" width="300" height="200">

As, pointed out by tb303 above, my html code doesn't need a slash. Anyways, I took it off & it still didn't work. Image is still broken. I ran a Google search & I'm surprised there was no useful reply even on stackoverflow.....
 
Back
Top