| | |
Php Mysql Image Help Please!!!
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2006
Posts: 52
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Feb 2006
Posts: 32
Reputation:
Solved Threads: 1
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.
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.
![]() |
Similar Threads
- php mysql image again PLEASE HELP (PHP)
- Php Mysql Image Question (PHP)
- PHP/MySQL programmer looking for project (Post your Resume)
- 5 Years Experiance In the PHP+MYSQL language and DB (Post your Resume)
- PHP/MySQL developer available (Post your Resume)
- Freelance PHP/MySQL Developer available (Post your Resume)
Other Threads in the PHP Forum
- Previous Thread: need help setting up a php site
- Next Thread: Prozilla Automall Coding Mod question
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert integration ip java javascript joomla ldap limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop open parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table template tutorial update upload url validation validator variable video web xml youtube





