GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 26-Mar-2009, 09:58
omicronpersei omicronpersei is offline
New Member
 
Join Date: Mar 2009
Posts: 1
omicronpersei is on a distinguished road

Image from Database to Email Attachment


Current Situation:

I am successfully storing images to MySQL, and succesfully retrieving them for display on a page in the following format:

<img width="106" height="160" border="0" src="imageserver.php?image_id=44">

where imageserver.php echos the appropriate header and data for the image:
...
$result = $db->queryRaw($sql) ;
header("Content-type: $type");
echo mysql_result($result, 0);
...

Problem:

I would like to attach these images to an email. I have successfully attached standard files (in the form 'image_44.jpg'), but when I use 'imageserver.php?image_id=44', I get the following types of errors:
Warning: filetype() [function.filetype]: Lstat failed for example

Warning: filesize() [function.filesize]: stat failed for example

Warning: fread() [function.fread]: Length parameter must be greater than 0 in...
An example of the code that fails is:

$fileatttype = filetype($fileatt);

which works fine when it's a regular file... is there an extra step I'm missing to make data pulled from a database readable as a regular file?
  #2  
Old 26-Mar-2009, 10:35
MisterChucker's Avatar
MisterChucker MisterChucker is offline
Junior Member
 
Join Date: Mar 2009
Location: Cyberspace, Earth
Posts: 53
MisterChucker is a jewel in the roughMisterChucker is a jewel in the roughMisterChucker is a jewel in the rough

Re: Image from Database to Email Attachment


I have not tested this solution.

You might want to try putting your HTML code directly into the email. You would need to make imageserver.php available on a public Web server (so that the email recipient has access to imageserver.php) and change the src value to the complete URL of the file. There is no email attachment.
Code:
<img width="106" height="160" border="0" src="http://example.com/imageserver.php?image_id=44" />
I think you need to set your email header to "Content-type: text/html" for this to work.
 
 

Recent GIDBlogNot selected for officer school by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image onto JFrame tedds Java Forum 8 25-Oct-2007 20:04
Bulk Email hosting *** .com Bullet proof hosting additional2 Web Hosting Advertisements & Offers 1 20-May-2007 13:55
bulk Email Marketing Bullet proof hosting additional2 Web Hosting Advertisements & Offers 0 08-Jul-2006 12:57
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 21:47

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:08.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.