CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Image Fields

Print topic Send  topic

Author Message
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?
View profile  Send private message
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..
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.