CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 [Unresolved - load a image from a blob field stored in database]

Print topic Send  topic

Author Message
CodeChargeMVP

Posts: 473
Posted: 05/18/2011, 1:03 AM

Hi,

We have focus to other of our customers,

they use to scan their invoices and we have develop the file upload component

by them to be able to record on the database an invoice scan image in a blob field,

this is actually working great, the thing now is than the customer wanna be able to

see the image stored in the blob db field.

I have think about develop a button which value showed "see invoice" or just "invoice" than

when the user click on it a new pop-up window load the image from the stored blob db field.

So I got some dummy question to do:

when the image is stored on the db field using the file upload component, I just see the data bytes, this is, [BLOB-26BYTES]

Do I need to store the image title by showed the image later or is it not necessary?

¿is there any special component or object by get the image and show on it?

finally

¿what is the best way to proceed?


_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/18/2011, 3:34 AM

By the way,

I have create a button which pop-ups a new window,

on this window I have create an simply img html tag,

I do not understand cause on other threads, they said to create

a

label and than change the label to image, is there any

difference by creating a image directly?

Since my point of view is the same code:

<img src="{Label1}" alt:"imagen" id="thisismyimage">

than

<img src="{Image1}" alt:"imagen" id="thisismyimage">
_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
damian

Posts: 838
Posted: 05/18/2011, 4:51 AM

when referencing other posts here 90% of them will not be storing images as blobs as that is not how ccs does it. when they are referencing {filename} or similar they are referencing a label that is referencing a db text field. you may have to look outside these forums for the answer to your question - although i think you will find it quite quickly as it is quite commonly done - just not by ccs.

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
Gena

Posts: 591
Posted: 05/18/2011, 4:52 AM

To put image to blob check this topic http://forums.codecharge.com/posts.php?post_id=93774

to show image from blob http://forums.codecharge.com/posts.php?post_id=98123
_________________
Gena
View profile  Send private message
damian

Posts: 838
Posted: 05/18/2011, 4:58 AM

awesome - good stuff Gena
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
Gena

Posts: 591
Posted: 05/18/2011, 5:29 AM

O:)
_________________
Gena
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/18/2011, 6:09 AM

Thank you very much for the massive response,

I´ll keep on mind, gotta keep trying my way and than will share the results.


_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/18/2011, 7:23 AM

The File Upload Component, append to the FileName anything similar to a timestamp this way:

201105181251180.image1.jpg;

to make work my solution I need than the image will be stored in the server with his original name,without that strange timestamp on the left, I have check out the help from CSS and see than is possible to change the name of the file on the "Before Process File", I have try this but seems than changing the name of the file produces an incompatibility between the file which is stored on the temp folder and the new one which is stored on the final folder, so anybody has a way to solve this?

I´ve found only one thread related to this event:
http://forums.codecharge.com/posts.php?post_id=83621



_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
damian

Posts: 838
Posted: 05/18/2011, 7:43 AM

are you working with an existing database with images stored as blobs? if so the ccs upload component wont help you. it stores images in the file system. if you are using the ccs file system it will prepend a datestamp to ensure (almost guaranteed) unique filenames even if 100 people upload a file called image1.jpg
you can of course use an after process file event to both rename the file and the database field but it may be more hassle than its worth.
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/18/2011, 8:14 AM

yes,

This is what I understand maybe i am wrong on some part, the File Upload Component saves the image physically on the server which is great cause this way I know the path and I just need the name of the image by have a complete path source for the img tag then will be able to show the image, and the File Upload Component has a "Control Source" which is the field from the database where the image will be stored, this field should be a blob field since is required by MySQL database.

Ok I´ll try to rename the file and trim the timestamp on the after file process.


Quote damian:
are you working with an existing database with images stored as blobs? if so the ccs upload component wont help you. it stores images in the file system. if you are using the ccs file system it will prepend a datestamp to ensure (almost guaranteed) unique filenames even if 100 people upload a file called image1.jpg
you can of course use an after process file event to both rename the file and the database field but it may be more hassle than its worth.

_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/18/2011, 8:32 AM

i´ve try this custom code on the after file process,

$Component->SetValue("check");

and when trying to save the form shows an error message:

"The File check specified in FileUpload1 were not found".

I´ve also try the add action "get original name" with same result

"The File Image specified in FileUpload1 were not found".

that action trims the timestamp from the original file name which is Image,

but unlucky shows that error message.



_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
damian

Posts: 838
Posted: 05/18/2011, 3:11 PM

the filename/control field should be some type of text field eg varchar and not blob. the file name will most likely be under 100 characters. blob is used for actually storing files not filenames. if you are using ccs to upload files you just need a filename (varchar) and an id (auto increment int). you might also want author, date, description, title etc etc.

have a read of this post for some more info:
http://forums.codecharge.com/posts.php?post_id=106430&s...d=upload+rename

also be aware that while the ccs default is to prepend the filename and that iswhat is stored in db - ccs also strips the timestamp when it displays the filename back to you - just for nice presentation :)

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/19/2011, 3:33 AM

I think we gonna confuse other users,

You want to mean than "Control User field from "File Upload Component" store the
name of the file than you are saving on the server and than the [Blob-26 Bytes] are
related to the filename", that what you said.

I think than when setting a longblob field on a database table and setting this field as the "Control source" of the "File Upload Component" you are storing the file on that database field so the [Blob-26 bytes] are related to the file.

My application is not a book store,so non of those is needed.

Ok is good, I will read it over :-D

Quote damian:
the filename/control field should be some type of text field eg varchar and not blob. the file name will most likely be under 100 characters. blob is used for actually storing files not filenames. if you are using ccs to upload files you just need a filename (varchar) and an id (auto increment int). you might also want author, date, description, title etc etc.

have a read of this post for some more info:
http://forums.codecharge.com/posts.php?post_id=106430&s...d=upload+rename

also be aware that while the ccs default is to prepend the filename and that iswhat is stored in db - ccs also strips the timestamp when it displays the filename back to you - just for nice presentation :)


_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message
CodeChargeMVP

Posts: 473
Posted: 05/19/2011, 4:10 AM

aha holy s h i t ,

yes I see, what "File Upload Component" stores on the database is the filename,

in fact I was saving different kind of files jpg,gif,png,bmp and always getting 26 bytes,

indeed because the name of file were always the same.

I�m glad to be wrong before now I understand what i�m doing.

I think this threads will be handy for changing name file after process file:

http://forums.codecharge.com/posts.php?post_id=58815
http://forums.codecharge.com/posts.php?post_id=58810

_________________
Best Regards
Entrepeneur | NT Consultant
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.

MS Access to Web

Convert MS Access to Web.
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.