[PHP] [REPOST] Converting Image Data Directly from MySQL

2002-03-06 Thread Josh Trutwin

Sorry for the repost but I did not get any responses to my first post.  :(

Anyone have any suggestions for fixing this one?



Hello list,

I've been stumped on this for a while, I have a large project where I am
storing image data in a MySQL db for reasons I will not get into.  The
images are displayed as thumbnails in a table which are hyperlinks to a
large file.  The larger file is stored in the db as a BLOB type in GIF
format.  I have a nice freeware program for creating thumbnails called
gifsicle.  I thought the following code would work:

// connect to db, set up SQL, etc. etc. etc.
$image = $row[image_data]; // this is the binary GIF image data

Header (Content-type: image/gif);
if ($view_type == thumbnail) {
   passthru (/usr/bin/gifsicle --resize 320x240   . $image);
}
echo $image;
flush();

This script works if called to view an image in full size, but if
$view_type is set to thumbnail and the passthru command is executed,
nothing is displayed.  gifsicle generally works like
this: /usr/bin/gifsicle --resize NNNxNNN  src_image  out_image.  I have
tried using system and exec as well, nothing seems to work except the
following:

$fp = fopen(/tmp/tmp.gif,w);
fwrite($fp, $image);
fclose($fp);
passthru(/usr/bin/gifsicle --resize 320x240  /tmp/tmp.gif);

This adds a LOT of file system I/O though as it has to write each full
sized image stored in the db /tmp and slows things down quite a bit.
Does anyone have any other suggestions?  My goal is to store only one
version of each image file and create smaller versions on the fly.

PHP is 4.1.2 on a SuSE Linux 7.3 box, latest Apache server, MySQL
3.23.44.

http://trutwins.homeip.net/phpinfo.php shows my php configuration.

Thanks for your help!

Josh Trutwin





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




[PHP] Converting Image Data Directly from MySQL

2002-03-05 Thread Josh Trutwin

Hello list,

Sorry for this cross post, I subscribed to PHP and PHP-DB, the PHP list
seems to be receiving about 95% of the traffic so I thought I'd post this
here as well to reach more of the PHP wizards.

I've been stumped on this for a while, I have a large project where I am
storing image data in a MySQL db for reasons I will not get into.  The
images are displayed as thumbnails in a table which are hyperlinks to a
large file.  The larger file is stored in the db as a BLOB type in GIF
format.  I have a nice freeware commandline program for creating thumbnails
called gifsicle.  I thought the following code would work:

// connect to db, set up SQL, etc. etc. etc.
$image = $row[image_data]; // this is the binary GIF image data

Header (Content-type: image/gif);
if ($view_type == thumbnail) {
   passthru (/usr/bin/gifsicle --resize 320x240   . $image);
}
else {
   echo $image;
}
flush();

This script works if called to view an image in full size, but if
$view_type is set to thumbnail and the passthru command is executed,
nothing is displayed.  gifsicle generally works like
this: /usr/bin/gifsicle --resize NNNxNNN  src_image  dest_image.  I have
tried using system and exec as well, nothing seems to work except the
following:

$fp = fopen(/tmp/tmp.gif,w);
fwrite($fp, $image);
fclose($fp);
passthru(/usr/bin/gifsicle --resize 320x240  /tmp/tmp.gif);

This adds a LOT of file system I/O though as it has to write each full
sized image stored in the db /tmp and slows things down quite a bit.
Does anyone have any other suggestions?  My goal is to store only one
version of each image file and create smaller versions on the fly.

PHP is 4.1.2 on a SuSE Linux 7.3 box, latest Apache server, MySQL
3.23.44.

Thanks for your help!

Josh Trutwin




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




Re: [PHP] Webmail

2002-03-05 Thread Josh Trutwin

 Hi

 can anyone quickly run through how to use php to send the contents of a
 form via e-mail using sendmail? How do you begin?

 thanks

I use this (omitting error checking):

$message = Name: $name\nAddress: $address\n;
mail([EMAIL PROTECTED], Message Subject, $message, From: $email);

This assumes that name, address, and email are form variables that the user
inputs.

See http://www.php.net/manual/en/function.mail.php for more information
about mail();

Josh Trutwin



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