NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Images from Raw Binary

Joseph Crawford codebowl at gmail.com
Mon Mar 14 09:58:32 EST 2005


Hello Everyone,

I have done this before so i know it works, however i also know i am
missing a step, maybe a replace or maybe even a foreach loop to do a
replace or something.

I am using a 3rd party solution to show some data on a clients site,
this is an MSSQL database, i have gotten it to connect fine FINALLY,
however now i run into a problem with the images.

Each record has an image column which i am told contains RAW Binary.

i have tried this code

$img = imagecreatefromstring($row['medium_photo']);
header('Content-Type: image/jpeg');
imagejpeg($img); 

however that results in this error

The image "http://66.111.250.100/test.php" cannot be displayed,
because it contains errors.

you can see the binary data by going to 
http://66.111.250.100/test.php

IIRC i needed to do some foreach loop on this binary data and perform
some operation on each element but i cannot remember what was needed
honestly.  This is where i call the help of you guys :D

-- 
Joseph Crawford Jr.
Codebowl Solutions
codebowl at gmail.com



More information about the talk mailing list