Broken Images

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

 



Hello,
 
I am attempting to grab an image from a MySQL table and echo it back to a
browser like so:
 
    <img border="1" src="./get_photo.php?image_id=<? echo $image_id; ?>">
 
 
<-----------------  Begin Code for WORKING NON-THUMBNAIL get_photo.php
----------------------------------->
 
if( $image_id ) <?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" />

{

  $sql = "SELECT image_bin_data, image_filetype from IMAGES where
image_id=$image_id";

  $result = db_query ( $sql );

  $record = db_fetch_object ( $result );

  $type = $record->image_filetype;

  $image = $record->image_bin_data;

  Header( "Content-type: $type");

  echo $image;

};

 

<-----------------  End Code for WORKING NON-THUMBNAIL get_photo.php
----------------------------------->
 
However, All I get is broken links. I think I am just not understanding how
all the Image functions need to line up. I do have GD compiled into PHP. I
have been trying to get this to work for quite a while now, so any help
would be appreciated. 
 
<-----------------  Begin Code for NON-WORKING THUMBNAIL get_photo.php
----------------------------------->
 
<?
include ( "./includes/common/common.php" );  
if( $image_id ) 
{
 $sql="SELECT image_bin_data, image_filetype from IMAGES where
image_id=$image_id";
 $result=db_query ( $sql );
 $record=db_fetch_object ( $result );
 $type=$record->image_filetype;
 $image=$record->image_bin_data;
 $new_w=75;
 $new_h=75;
 Header("Content-type: $type");
 $dst_img=ImageCreate($new_w, $new_h);
 $src_img=ImageCreateFromGif($image);
 
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),I
mageSY($src_img));
 imageGif($dst_img);
 echo $src_img;
 imagedestroy($dst_img);
 imagedestroy($src_img);
}
?> 
 
<-----------------  End Code for get_photo.php
----------------------------------->

-------------------------------------------
Randy Rankin, MCSE
Network Management Professional
IBM Global Services
randy.rankin@smith-blair.com
Phone:(870) 773-5148
Fax:  (870) 773-5211


 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux