Re: Re: Displaying images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miller, Terion wrote:
> 
> 
> Well I have tried Numerous scripts and ways and still can't get the image to display.
> 
> I have echoed the file and have been able to get the gibberish image code to display but not a real image, here is my full code if anyone wants to have a look, I am going crossed eyed here.
> 
> 
> 
> 
> 
> These are just a few of the ways I have been trying to get the img tag to work on my output.php page:
> 
>        <tr>            <td>Scout Photo:</td>              <td>              <a href="image.php?filename=<?php echo$row['photoName']; ?>"><?php echo$row['photoName']; ?></A><br>                            <?php echo "\n<br>Scout Photo : "."<img src=\image.php?filename=" .$row['photoName']. "\">"; ?>                                          <?php echo "<img src=\"image.php?filename=".$row['photoName']."\">\n"; ?>                            <?php echo "<img src=\"image.php?id=".$row['ePID']."\">\n"; ?>                            <img src="image2.php?filename=<?php echo $row['photoName']; ?>">
> 
> 
> Here is one way I was trying to get to work for the image.php page where the headers are supposed to work and don't
> 
> include("inc/dbconn_open.php");
> error_reporting(E_ALL);
> 
> 
> //if (isset($_FILES['ePhoto'])){$ePhoto = $_FILES['ePhoto'];} else {$ePhoto ="";}
> 
> $filename = $_GET['$filename'];
> 
> $image = stripslashes($_REQUEST[photoName]);
> 
> $sql = "SELECT ePhoto, photoName, photoType from eagleProjects WHERE photoName = $filename";
> $result=mysql_query($sql);
> $data = mysql_fetch_array ($result);
> 
> 
> 
> $type = $data['photoType'];
> $name = $data['photoName'];
> 
>   header("Content-type: $type");
>   header("Content-Disposition: attachment; filename=$name");
> 
> 
> echo $data["photoName"];
> echo $data["ePhoto"];
> 
> exit;

It's hard to tell, not knowing what the db fields contain, but the two
glaring issues are:

1. unless photoType is image/something then it won't work.  It can't
just be jpeg or gif.  So maybe do header("Content-type: image/$type");
assuming $type is correct.

2. Since $data["photoName"]; is not of type image/whatever, the echo may
break the display.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux