944,168 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 2040
  • PHP RSS
May 23rd, 2006
0

Php Mysql Image Help Please!!!

Expand Post »
Hello and a BIG Thank-You!!! To you who have helped me...

This I think will be my last image question. Okay the user uploaded a picture , it went to the (Photos directory) (Name and Type Show) Great!... Next to the (Mysql Database under aphoto_filename) Again with (Name and Type Showing) Excellent!, It is in the users Mysql Database listing with all their other information. So Perfect! Last it shows up Beautiful!

Brick Wall I'm exhausted even missed school trying to solve it, I cannot do that again.
PROBLEM TO BE SOLVED:

When the user leaves the photo view page, I cannot get their photo to stay reappear. It remains in the photos directory and in the mysql database... When I try calling it... It only displays the image name and type I need it to open.

Please See My Code Below and Thank A Zillion!


<?
include'db.php';

$sql_check = mysql_query("SELECT aphoto_filename FROM gallery_photos WHERE email_address='".($email_address)."'AND password='".($password)."'" );

$aphoto_filename = mysql_fetch_array($sql_check,
MYSQL_ASSOC); //MYSQL_ASSOC;
$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){

if ($type == "image/pjpeg") {
imagejpeg($img);
} else if ($type == "image/x-png") {
imagepng($img);
} else if ($type == "image/gif") {
imagegif($img);
}
$handle = fopen($aphoto_filename['tmp_name'], $images_dir."/$filename". "wb");

echo ("");
} else {
echo $aphoto_filename['aphoto_filename'];
}

?>

P.S I actually have... aphoto, bphoto, cphoto and dphoto ... When anyone wants to see the users photo I need the photos to open. Thanks again soooooo much, puddin
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
puddin is offline Offline
52 posts
since Mar 2006
May 23rd, 2006
0

Re: Php Mysql Image Help Please!!!

Your overthinking this.

All you have to do is echo the HTML to display the image from the directory it's in.

[php]echo "<img src='/path/to/" . $filename . " ' />[/php]

No need to use fopen to open the image.
Reputation Points: 10
Solved Threads: 1
Light Poster
BlazingWolf is offline Offline
32 posts
since Feb 2006
May 23rd, 2006
0

Re: Php Mysql Image Help Please!!!

Gee Wiz

I must not be filling it in correctly...
echo "<img src='/path/to/" . $filename . " ' />

Is the path/to $images_dir And The $filename Is $aphoto_filename?
It's not coming up... I'll keep trying...
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
puddin is offline Offline
52 posts
since Mar 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: need help setting up a php site
Next Thread in PHP Forum Timeline: Prozilla Automall Coding Mod question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC