CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Store and display images from database

Print topic Send  topic

Author Message
Karen
Posted: 09/08/2003, 9:25 PM

I would like to store images directly into the database instead of filesystem. There is an article on how to do this with CC but not CCS. I'm using CCS/PHP/MySQL. Also, once stored, is displaying the images straightforward? Would appreciate any help at all. TIA!
feha
Posted: 09/09/2003, 2:28 AM

Hi Karen
I'm working to solve that problem,I will send an e-mail to You when finnished.
Just let me know your e-mail address.
It is much bettter to store images for products within same record, if you delete a product than the image will be gone and no "trash" on the server.

Regards
feha
[www.vision.to]
Soon
www.WebShopXL.com
Karen
Posted: 09/09/2003, 6:59 AM

Thanx for your kind offer, feha. My email addy isarchitech@awes2001.com. I hope it isn't going to be complicated, though!
feha
Posted: 09/10/2003, 6:37 AM

Karen Use This SQL query to insert images in to DB instead of usual CCS ToSQL syntax ...

$DBimage = new clsDBddd();
global $images_table;
$images_table="image_gallery";
$SQL="INSERT INTO $images_table
(title, alttext, src, des, filename, filesize, filetype, img_width, img_height)
VALUES
(\"$alt_text\", \"$alt_text\", \"$data\", \"$str_description\", \"$file_name\", \"$file_size\", \"$file_type\", \"$img_width\", \"$img_height\")
";
$DBimage->query($SQL);

$DBimage->close();
unset($DBimage);

so this works well

regards
feha
[www.vision.to]
Karen
Posted: 09/10/2003, 7:34 AM

Thanx, feha. One more thing, how do we then display the image? Is it as simple as just assigning the database column to a control? Any type of control? Pls advise. TIA!
feha
Posted: 09/10/2003, 11:15 AM

<?

//Show Image from MySQL by www.vision.to (Femi Hasani)
define("RelativePath", "..");
include(RelativePath . "/Common.php");

$dbname="clsDBddd";
$DBimage = (new $dbname);
$SQL = "SELECT src,filetype FROM image_gallery WHERE img_id=".$img_id;
$DBimage->query($SQL);
while($DBimage->next_record())
{
$image = $DBimage->f("src");
$filetype= $DBimage->f("filetype");
}
$DBimage->close();
unset($DBimage);

Header ( "Content-Type: ".$filetype);
//Header ("Cache-Control: no-cache, must-revalidate");
//Header ("Pragma: no-cache");

echo $image;
?>

regards
feha
[www.vision.to]
feha
Posted: 09/10/2003, 11:19 AM

the last part put it this way

Header ("Cache-Control: no-cache, must-revalidate");
Header ("Pragma: no-cache");
Header ( "Content-Type: ".$filetype);
Karen
Posted: 09/10/2003, 8:04 PM

This will just show the image on the page, right? How do I assign it to a control as part of the form? Sorry to ask so many questions. Thanx for your help, feha.
Re:
Posted: 09/10/2003, 10:21 PM

Example: You want to show image from DB with img_id=24

<img border="0" width="280" height="210" src="show_image.php?img_id=21" alt="image">


Have A Nice Day :-)

Regards
feha
[www.vision.to]

feha
Posted: 09/12/2003, 2:36 AM

before show row event ....

global <yourformname>;
$pic_id=<yourformname>-><your_hidden_field_img_id>->GetValue();
$show_image="<img border=\"0\" width=\"280\" height=\"210\" src=\"show_image.php?img_id=$pic_id\" alt=\"image\">";

<yourformname>-><your_label_name>->SetValue($show_image);
//make sure a label property to show HTML (not TEXT)

this will show images from every record depending how meny rows you are listing ...

Hope this helps?

Regards
feha
[www.vision.to]

Karen
Posted: 09/12/2003, 7:58 AM

Thanks, feha. I've got the gist of it. I'll be working on it and it should be ok. Thanks a lot for your help.

   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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