Categories > OpenTBS with XLSX >

Pictures in excel

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Hass
Date: 2008-10-26
Time: 12:46

Pictures in excel

Is it possible to list a pictures from Mysql table in excel template.
I used the magnet parameter [blk.image;magnet=img;mtype=m*] without success. Could someone please help.

Thanks
Hass
By: TomH
Date: 2008-10-26
Time: 21:38

Re: Pictures in excel

Can't guess at what's  broken in your code without seeing it

Please show your php and template code as actually written

By: Hass
Date: 2008-10-26
Time: 22:53

Re: Pictures in excel

[book.image;magnet=img;mtype=m*] image is a database column.

Datatype in database is Blob so it is binary.
When the data is displaed it is just binar in excel cell. How to convert it to a real picture.

// Load the Excel template
$TBS->LoadTemplate('XXXXXX.xls') ;
$TBS->MergeBlock('book',$cnx_id,"SELECT * FROM XXXXX") ;

Thanks,
By: TomH
Date: 2008-10-27
Time: 03:51

Re: Pictures in excel

Well, the code you gave doesn't show how you're processing the binary data - so I don't see how we can help you - except to say you need to Google "binary data in MySQL" and follow the bouncing ball on your own.

It's a complex issue and is pretty well considered to be NOT the way to handle images. Put the filename in the database - yes, but the actual binary image data - no a good idea and IMNSHO not a good application architecture  either.

Sorry to be so negative, but this is not a new subject in application design and I've never seen it work in 12 years of PHP/MySQL development.

Best of luck,
By: Hass
Date: 2008-10-27
Time: 04:43

Re: Pictures in excel

I have tried to put the file name in the database but TBS would just put the name not the picture. I put different tags to diffrent location for the picture without success.
Do you have an example for me to see how to show the picture instead of the link.
Thanks TomH
By: Skrol29
Date: 2008-10-27
Time: 11:07

Re: Pictures in excel

Hi Hass,

I agree with TomH, inserting binary data can be complex.
You need to explore how Excel stores binary data for images in a XML Excel document. Since you understand the concept, (I don't know it), you can manage TBS to transform the MySQL binary data into the Excel binary data for images.