Re: Loading image data from DB
Thanks, Jeanne. I suppose one of the drawbacks of high level programming is that it insulates us so much from the ones and zeros that those of us who came into x-talking from a non-programming background never quite got some of the fundamentals. As this example shows, there are times when understanding the basics make the difference between success and failure. Devin On Apr 11, 2006, at 7:42 PM, Jeanne A. E. DeVoto wrote: At 10:47 AM -0600 4/7/2006, Devin Asay wrote: Which is essentially what I ended up doing, and it worked. Is it correct to assume that 'the text' is binary data expressed as ASCII text and data like 'the imageData' is lower-level code that can't be expressed visually in a meaningful way? Forgive my naive non-techie questions. Not exactly - any binary data can be expressed in terms of ASCII (or extended ASCII) characters. Looking at an example: A typical byte's worth of binary data (8 bits): 01101101 That same binary number, expressed in decimal (ordinary base-10 numbers): 64 + 32 + 8 + 4 + 1, or 109 ASCII 109 is the character m, so we could write that byte's worth of binary data as m. Any 8-bit segment of binary data can be expressed as a single ASCII character, in the same fashion, so we can always represent binary data as characters. The main fly in the ointment is that some of those characters are control characters, or characters that don't have a glyph to represent them, and some of those will cause real trouble if you try to e.g. display them in a field. (For example, the binary sequence is perfectly valid and may show up in the binary data of any picture, but the character it's equivalent to is the null character, ASCII 0 - which can't be displayed on screen.) This is the basic difference between binary data and text data - you can represent either one of them as either strings of ones and zeroes, or as sequences of ASCII characters, but text is guaranteed to contain only characters in the subset that can be represented in a text file, whereas in binary data, anything goes, and a sequence of 8 bits might translate into any character. Am I correct in my understanding that these two statements are functionally identical: put myData into image myImage set the text of image myImage to myData ? In other words, 'put' is simply shorthand for 'set the text of object'? Yes. The text property of a container object (an image, button, or field) is the same as a reference to that object. It works for images just like for fields. Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
At 10:47 AM -0600 4/7/2006, Devin Asay wrote: Which is essentially what I ended up doing, and it worked. Is it correct to assume that 'the text' is binary data expressed as ASCII text and data like 'the imageData' is lower-level code that can't be expressed visually in a meaningful way? Forgive my naive non-techie questions. Not exactly - any binary data can be expressed in terms of ASCII (or extended ASCII) characters. Looking at an example: A typical byte's worth of binary data (8 bits): 01101101 That same binary number, expressed in decimal (ordinary base-10 numbers): 64 + 32 + 8 + 4 + 1, or 109 ASCII 109 is the character m, so we could write that byte's worth of binary data as m. Any 8-bit segment of binary data can be expressed as a single ASCII character, in the same fashion, so we can always represent binary data as characters. The main fly in the ointment is that some of those characters are control characters, or characters that don't have a glyph to represent them, and some of those will cause real trouble if you try to e.g. display them in a field. (For example, the binary sequence is perfectly valid and may show up in the binary data of any picture, but the character it's equivalent to is the null character, ASCII 0 - which can't be displayed on screen.) This is the basic difference between binary data and text data - you can represent either one of them as either strings of ones and zeroes, or as sequences of ASCII characters, but text is guaranteed to contain only characters in the subset that can be represented in a text file, whereas in binary data, anything goes, and a sequence of 8 bits might translate into any character. Am I correct in my understanding that these two statements are functionally identical: put myData into image myImage set the text of image myImage to myData ? In other words, 'put' is simply shorthand for 'set the text of object'? Yes. The text property of a container object (an image, button, or field) is the same as a reference to that object. It works for images just like for fields. -- jeanne a. e. devoto ~ [EMAIL PROTECTED] http://www.jaedworks.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
Devin, The trick seems to be that you upload and download the image data as *text* (as opposed to the imageData of the image, which is binary.) I may have this all wrong conceptually, but that's how it finally made sense to me. An image's Text property is binary data that comprises the image. The problem arises because, until one reads the Dictionary, one might easily assume an image's Text property contains text, just like a field. So, just as one might... get URL ((file:textFileName)) put it into field Main Text one should be able to (untested) get URL ((binfile:imageFileName)) put it into image Main Image Rob Cozens CCW, Serendipity Software Company And I, which was two fooles, do so grow three; Who are a little wise, the best fooles bee. from The Triple Foole by John Donne (1572-1631) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
On Apr 7, 2006, at 10:32 AM, Rob Cozens wrote: Devin, The trick seems to be that you upload and download the image data as *text* (as opposed to the imageData of the image, which is binary.) I may have this all wrong conceptually, but that's how it finally made sense to me. An image's Text property is binary data that comprises the image. The problem arises because, until one reads the Dictionary, one might easily assume an image's Text property contains text, just like a field. So, just as one might... get URL ((file:textFileName)) put it into field Main Text one should be able to (untested) get URL ((binfile:imageFileName)) put it into image Main Image Which is essentially what I ended up doing, and it worked. Is it correct to assume that 'the text' is binary data expressed as ASCII text and data like 'the imageData' is lower-level code that can't be expressed visually in a meaningful way? Forgive my naive non- techie questions. Am I correct in my understanding that these two statements are functionally identical: put myData into image myImage set the text of image myImage to myData ? In other words, 'put' is simply shorthand for 'set the text of object'? Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
Devin, Is it correct to assume that 'the text' is binary data expressed as ASCII text and data like 'the imageData' is lower-level code that can't be expressed visually in a meaningful way? My assumption is the image's Text is identical to the content of the gif, jpeg, or whatever image file it was loaded from. The imageData is in rev-proprietary format regardless of original image type, and it contains the image at the size and resolution it is displayed on the screen. Rob Cozens CCW, Serendipity Software Company And I, which was two fooles, do so grow three; Who are a little wise, the best fooles bee. from The Triple Foole by John Donne (1572-1631) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
All: put the imageData of image picImage into tBits I asked this question before, and I still haven't gotten to the point of testing: Why does everyone choose the imageData of the image instead of its text? From Rev Dictionary: The imageData, unlike the contents of the image container, is based on the picture as its presented on the screen, not stored in the image object. This means that if you resize an image, the content of the image does not change, but its imageData does. If you create an image and then reduce its size, its imageData reflects the scaled-down, displayed image, not the original full-scale image. If you create a second image and set its imageData property to the imageData of the original image, resizing the first image back to the original dimensions displays the original image at full resolution, but resizing the second image does not, because setting its imageData transferred only the scaled-down version of the original. I read this to say, If you want to retain the original contents of an image, store its text NOT its imageData. What am I missing? Rob Cozens CCW, Serendipity Software Company And I, which was two fooles, do so grow three; Who are a little wise, the best fooles bee. from The Triple Foole by John Donne (1572-1631) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
Thanks to Chris and Rob I've got this working. Rob proves once again how reading the blinking manual can make you look like a genius. (Not to imply that Rob is not one, just that in addition to his native intelligence he has a passel of common sense.) Chris's contribution was a necessary part of the solution: On Apr 5, 2006, at 8:32 PM, chris bohnert wrote: when returning the data i do put select name,imageData from limage where name=' tImgName ' into tsql put revdb_queryblob(tconnectionid,tsql) into tRS if not revdb_iseof(tRS) then put revDatabaseColumnNamed(tRS,name,tPicName) set the text of field strPicName to tPicName put revDatabaseColumnNamed(tRS,imageData,tImageDat) set the imagedata of image picImage to tImageDat answer got a result end if But I was only getting a band of random colors on the edge of my image object. Then Rob provided the final piece: On Apr 6, 2006, at 9:18 AM, Rob Cozens wrote: All: put the imageData of image picImage into tBits I asked this question before, and I still haven't gotten to the point of testing: Why does everyone choose the imageData of the image instead of its text? From Rev Dictionary: snip I read this to say, If you want to retain the original contents of an image, store its text NOT its imageData. My final solution for loading an image from a database looks like this: put word 2 of the selectedline of fld linenumbers into tEntryNum put select illustration from vocablist where item_index=' tEntryNum ' into tsql put revdb_queryblob(connID,tsql) into tRS if not revdb_iseof(tRS) then put revDatabaseColumnNamed(tRS,illustration,tImageDat) put tImageDat into image testImg end if Thanks again. Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
Shucks, Devin Rob proves once again how reading the blinking manual can make you look like a genius. (Not to imply that Rob is not one, Even a Triple Foole can come off looking smart once in a while. :{`) Rob ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
Rob- Thursday, April 6, 2006, 8:47:40 AM, you wrote: Even a Triple Foole can come off looking smart once in a while. :{`) ...gotta watch it or you'll lose your amateur standing... -- -Mark Wieder [EMAIL PROTECTED] ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
Now I've figured out the other half of this cycle: how to upload image data to a database. The trick seems to be that you upload and download the image data as *text* (as opposed to the imageData of the image, which is binary.) I may have this all wrong conceptually, but that's how it finally made sense to me. This is how I'm doing it for files external to the stack: put fld entryNumber into tEntryNum put binfile: the filename of image testImg into fileNm put url fileNm into tBits put update vocablist set illustration = :1 where item_index=' tEntryNum ' into tQuery get revdb_execute(connID, tQuery,*btBits) -- (*b tells it to send the text as a binary stream.) For internal files this worked: put fld entryNumber into tEntryNum put image leaf into tBits put update vocablist set illustration = :1 where item_index=' tEntryNum ' into tQuery get revdb_execute(connID, tQuery,*btBits) I hope this saves someone some time and frustration. Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Loading image data from DB
I know this can be done, but it's got me stumped. Nothing conclusive from archives. I want to store image data in a mysql database and then show it in an image object in Rev. I successfully loaded an image into a field of type longblob. I know the data is there and that it's valid. This is what I tried to load the image data: global connID -- my connection id on mouseUp if connID is empty then answer You need to connect to the database first. exit to top end if put word 2 of the selectedline of fld linenumbers into tEntryNum put select illustration from vocablist where item_index = tEntryNum into tQuery put revDataFromQuery(,,connID,tQuery) into tData set the imagedata of img testImg to tData end mouseUp The query ends up something like this: select illustration from vocablist where item_index = 1290 All I ever get in the tData variable is four random characters; ˇÿˇ‡ I know the image data in the database table is valid because I can set up an automatic query in the Database Query Builder, then set the image object to automatically load that data, and it works. I've tried to find the scripting in the Database Query Builder stack that does this, but no luck. Has anyone successfully done this who can share the secret to making it work? Thanks, Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
On 5 Apr 2006, at 23:37, Devin Asay wrote: I know this can be done, but it's got me stumped. Nothing conclusive from archives. I want to store image data in a mysql database and then show it in an image object in Rev. I successfully loaded an image into a field of type longblob. I know the data is there and that it's valid. This is what I tried to load the image data: global connID -- my connection id on mouseUp if connID is empty then answer You need to connect to the database first. exit to top end if put word 2 of the selectedline of fld linenumbers into tEntryNum put select illustration from vocablist where item_index = tEntryNum into tQuery put revDataFromQuery(,,connID,tQuery) into tData set the imagedata of img testImg to tData end mouseUp Did you try using revQueryDatabaseBlob instead of revDataFromQuery? Cheers Dave ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
On Apr 5, 2006, at 3:37 PM, Devin Asay wrote: I know this can be done, but it's got me stumped. Nothing conclusive from archives. I want to store image data in a mysql database and then show it in an image object in Rev. I successfully loaded an image into a field of type longblob. I know the data is there and that it's valid. ... Has anyone successfully done this who can share the secret to making it work? Devin, I think there is a bug when retrieving binary data using the mysql driver. If you get it to work I would like to know. I messed with this briefly the other day and couldn't get the binary data out that I put in. -- Trevor DeVore Blue Mango Learning Systems - www.bluemangolearning.com [EMAIL PROTECTED] ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
On Apr 5, 2006, at 4:55 PM, Dave Cragg wrote: On 5 Apr 2006, at 23:37, Devin Asay wrote: I know this can be done, but it's got me stumped. Nothing conclusive from archives. I want to store image data in a mysql database and then show it in an image object in Rev. I successfully loaded an image into a field of type longblob. I know the data is there and that it's valid. This is what I tried to load the image data: global connID -- my connection id on mouseUp if connID is empty then answer You need to connect to the database first. exit to top end if put word 2 of the selectedline of fld linenumbers into tEntryNum put select illustration from vocablist where item_index = tEntryNum into tQuery put revDataFromQuery(,,connID,tQuery) into tData set the imagedata of img testImg to tData end mouseUp Did you try using revQueryDatabaseBlob instead of revDataFromQuery? Yep. I tried it. Same results. Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
On Apr 5, 2006, at 5:43 PM, Trevor DeVore wrote: On Apr 5, 2006, at 3:37 PM, Devin Asay wrote: I know this can be done, but it's got me stumped. Nothing conclusive from archives. I want to store image data in a mysql database and then show it in an image object in Rev. I successfully loaded an image into a field of type longblob. I know the data is there and that it's valid. ... Has anyone successfully done this who can share the secret to making it work? Devin, I think there is a bug when retrieving binary data using the mysql driver. If you get it to work I would like to know. I messed with this briefly the other day and couldn't get the binary data out that I put in. -- Trevor DeVore Well, at least I'm not alone in this. What puzzles me is that it works flawlessly when I set up an automatic query in Database Query Manager. I tried and failed to find the script that executes the query in the DQM stacks. I'll Bugzilla this if there isn't already a bug report on it. Anyone know? Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Loading image data from DB
The only way i've ever been able to get this to work is by using the variable binding when inserting data into the blob. By using the *b prefix on the variable name in the execute parameter the binary encoding routines kick in. put the imageData of image picImage into tBits put the text of field strPicName into tName get revdb_execute(tconnectionid, insert into limage(name,imageData) values(:1,:2),tName,*btBits) then when returning the data i do put select name,imageData from limage where name=' tImgName ' into tsql put revdb_queryblob(tconnectionid,tsql) into tRS if not revdb_iseof(tRS) then put revDatabaseColumnNamed(tRS,name,tPicName) set the text of field strPicName to tPicName put revDatabaseColumnNamed(tRS,imageData,tImageDat) set the imagedata of image picImage to tImageDat answer got a result end if -- cb Devin Asay wrote: On Apr 5, 2006, at 5:43 PM, Trevor DeVore wrote: On Apr 5, 2006, at 3:37 PM, Devin Asay wrote: I know this can be done, but it's got me stumped. Nothing conclusive from archives. I want to store image data in a mysql database and then show it in an image object in Rev. I successfully loaded an image into a field of type longblob. I know the data is there and that it's valid. ... Has anyone successfully done this who can share the secret to making it work? Devin, I think there is a bug when retrieving binary data using the mysql driver. If you get it to work I would like to know. I messed with this briefly the other day and couldn't get the binary data out that I put in. --Trevor DeVore Well, at least I'm not alone in this. What puzzles me is that it works flawlessly when I set up an automatic query in Database Query Manager. I tried and failed to find the script that executes the query in the DQM stacks. I'll Bugzilla this if there isn't already a bug report on it. Anyone know? Devin Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution --No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.3.5/301 - Release Date: 4/4/2006 ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution