valueweb
Posts: 8
|
| Posted: 06/06/2006, 4:00 AM |
|
I am using CC3 to produce PHP for linux server.
I have a MYSQL Database where one table includes a blob field column for a product image
I have included this field as an image in a grid, set all the properties from the drop down menus as appropriate but am just getting the Red X placeholder instead of an image when published.
Can anyone tell me what I'm doing wrong?
|
 |
 |
WKempees
|
| Posted: 06/06/2006, 4:28 AM |
|
This will not work the way you do it.
What you need is a separate PhP file like get_image.php
In your image you make it get_image.php?imageid=
get_image.php would basically:
open connection to database
select the row from the database containing the image identified by imageid.
echo the content of the BLOB
<?php
$db = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
mysql_select_db(DB_DATABASE,$db);
$result = mysql_query("SELECT <picture> from <TABLENAME> where id=$id",$db);
Header( "Content-type: images/jpg");
while($rij = mysql_fetch_array($result)) {
echo "$rij[0]";
}
?>
Is code that needs ammending to be used by you, but gives you an idea which
path to follow.
There are also some posts in the forum describing this.
Use the SEARCH in the top menu of the forum and search for: BLOB image
might give you some more.
Walter
|
|
|
 |
DonB
|
| Posted: 06/06/2006, 8:16 PM |
|
I wonder if it could be possible to create your page with the <imc
src="getimage.php?id=1"> and write another page, getimage.php, to have NO
html elements, just the header() statements that designate the content-type
as "image/jpeg" (or whatever is appropriate). With just an echo
$db->f("blobcolumn") in the page before show event it would stream the blob
to the browser. I assume it would fetch record #1 from your database to
locate the appropriate blob. This is just an example, of course.
Now, would that be handled/interpreted by the browser as if an image file
URL was specified (as normally is done)? I don't know. I have not tried it
and it's late. ZZZZZZZZZZZzzzzzz
But that's how you stream PDFs or other binary data to the browser. Might
work for this too.
--
DonB
http://www.gotodon.com/ccbth
"WKempees" <kempe819@planet.nl> wrote in message
news:e63os8$dom$1@news.codecharge.com...
> This will not work the way you do it.
> What you need is a separate PhP file like get_image.php
> In your image you make it get_image.php?imageid=
> get_image.php would basically:
> open connection to database
> select the row from the database containing the image identified by
imageid.
> echo the content of the BLOB
>
>
> <?php
>
> $db = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
> mysql_select_db(DB_DATABASE,$db);
>
> $result = mysql_query("SELECT <picture> from <TABLENAME> where
id=$id",$db);
> Header( "Content-type: images/jpg");
>
> while($rij = mysql_fetch_array($result)) {
>
> echo "$rij[0]";
> }
> ?>
>
>
>
> Is code that needs ammending to be used by you, but gives you an idea
which
> path to follow.
> There are also some posts in the forum describing this.
> Use the SEARCH in the top menu of the forum and search for: BLOB image
> might give you some more.
>
> Walter
>
>
|
|
|
 |
valueweb
Posts: 8
|
| Posted: 06/07/2006, 3:33 AM |
|
Thanks for the help guys!
Anyway, I've decided to give in and get the images into a separate directory and reference them from the DB table..
|
 |
 |
|