|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
Saving image from Database_FMcontainer saves only first foundHi list,
I finally found out saving images from a FMSA 9 image container field. Problem is now that displaying each image works but when I save the images it saves the image from the first found record. If found_count is i.ex. 5 it saves 5 images that all are the first image inline: ....to get the record with id and return (field:'nid')... records; // find this records images from another db inline: -Database='Bilder',-InlineName='bilder', -Layout='BilderLasso', 'nid'= (field:'nid'), -search; /inline; records:-InlineName='bilder'; if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); Var: 'filedata' = (Database_FMContainer: 'Bilde'); Var: 'image' = (Image: -Binary=$filedata); $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- Quality=100); /if; /records; /records; /inline; I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- but they all are the image from the first container field. /asle benoni -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundWhat does this show?
inline: ....to get the record with id and return (field:'nid')... records; field('nid')'<br>'; // find this records images from another db --steve On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: >Hi list, > >I finally found out saving images from a FMSA 9 image container field. >Problem is now that displaying each image works but when I save the >images it saves the image from the first found record. If found_count >is i.ex. 5 it saves 5 images that all are the first image > >inline: ....to get the record with id and return (field:'nid')... >records; > >// find this records images from another db >inline: -Database='Bilder',-InlineName='bilder', > -Layout='BilderLasso', > 'nid'= (field:'nid'), > -search; >/inline; > >records:-InlineName='bilder'; > if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); > Var: 'filedata' = (Database_FMContainer: 'Bilde'); > Var: 'image' = (Image: -Binary=$filedata); > $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >Quality=100); > /if; >/records; > >/records; >/inline; > >I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >but they all are the image from the first container field. > >/asle benoni > > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Steve Piercy Web Site Builder Soquel, CA <web@...> <http://www.StevePiercy.com/> -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundHi Steve,
Here is the code I tested: var:'nid' = (action_param:'nid'); inline: -Database='NaRIn', -Layout='phpliste', -KeyValue= $nid, -Search, -MaxRecords='1'; records; var:'narinid'= (field:'NaRInID'); inline: -Database='Bilder', -Layout='BilderLasso', 'NaRInID'= $narinid, -Search; ($narinid)' found:' found_count; records; '<br>'(KeyField_Value); /records; /inline; /records; /inline; Result: 1k6kKTdjnC found:9 184 185 186 188 189 192 193 194 195 So I find the record, then pull out the field (NaRInID). Then I search the layout (Bilder) for matching records. As you see I found 9 records and the KeyField_Value of each picture. But the first picture (184) is written 9 times so all the pictures like 184.jpg is exactly the same as 186.jpg etc. Am I understandable? /asle benoni Den 12. juli. 2008 kl. 03.28 skrev Steve Piercy - Web Site Builder: > What does this show? > > inline: ....to get the record with id and return (field:'nid')... > records; > > field('nid')'<br>'; > > // find this records images from another db > > --steve > > > On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: > >> Hi list, >> >> I finally found out saving images from a FMSA 9 image container >> field. >> Problem is now that displaying each image works but when I save the >> images it saves the image from the first found record. If found_count >> is i.ex. 5 it saves 5 images that all are the first image >> >> inline: ....to get the record with id and return (field:'nid')... >> records; >> >> // find this records images from another db >> inline: -Database='Bilder',-InlineName='bilder', >> -Layout='BilderLasso', >> 'nid'= (field:'nid'), >> -search; >> /inline; >> >> records:-InlineName='bilder'; >> if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); >> Var: 'filedata' = (Database_FMContainer: 'Bilde'); >> Var: 'image' = (Image: -Binary=$filedata); >> $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >> Quality=100); >> /if; >> /records; >> >> /records; >> /inline; >> >> I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >> but they all are the image from the first container field. >> >> /asle benoni >> >> >> > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > Steve Piercy Web Site Builder Soquel, CA > <web@...> <http://www.StevePiercy.com/> > > -- > This list is a free service of LassoSoft: http://www.LassoSoft.com/ > Search the list archives: http://www.ListSearch.com/Lasso/Browse/ > Manage your subscription: http://www.ListSearch.com/Lasso/ > -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundHi Asle,
Okay, so that confirms the assumption that you are returning the proper record set. I assume that you delete .jpg's from the directory '../storebilder/' every time before you run the script. I've commented the previous tests. I also commented the if.../if statement, just to see what will happen. This version should write each image to the file system. I also inserted an error statement to indicate whether file permissions are properly configured to write the image files. Prior to running the script, delete all the images from the directory '../storebilder/'. After running the script, see if you get the expected results. If so, then uncomment the if.../if statement, and repeat the test. Let us know how it goes. var:'nid' = (action_param:'nid'); inline: -Database='NaRIn', -Layout='phpliste', -KeyValue= $nid, -Search, -MaxRecords='1'; records; var:'narinid'= (field:'NaRInID'); inline: -Database='Bilder', -Layout='BilderLasso', 'NaRInID'= $narinid, -Search; // ($narinid)' found:' found_count; records; // '<br>'(KeyField_Value); // if(!(file_exists('storebilder/'(KeyField_Value)'.jpg'))); var('image' = Image(-Binary=Database_FMContainer('Bilde'))); $image->save('../storebilder/'(KeyField_Value)'.jpg',-Quality=100); '<br>'(KeyField_Value)': 'file_currenterror; // /if; /records; /inline; /records; /inline; --steve On Sunday, July 13, 2008, asle@... (Asle Benoni) pronounced: >Hi Steve, >Here is the code I tested: > >var:'nid' = (action_param:'nid'); >inline: -Database='NaRIn', > -Layout='phpliste', > -KeyValue= $nid, > -Search, > -MaxRecords='1'; > >records; >var:'narinid'= (field:'NaRInID'); > >inline: -Database='Bilder', > -Layout='BilderLasso', > 'NaRInID'= $narinid, > -Search; > ($narinid)' found:' found_count; >records; >'<br>'(KeyField_Value); >/records; >/inline; >/records; >/inline; > >Result: >1k6kKTdjnC found:9 >184 >185 >186 >188 >189 >192 >193 >194 >195 > >So I find the record, then pull out the field (NaRInID). Then I search >the layout (Bilder) for matching records. As you see I found 9 records >and the KeyField_Value of each picture. But the first picture (184) is >written 9 times so all the pictures like 184.jpg is exactly the same >as 186.jpg etc. > >Am I understandable? > >/asle benoni > >Den 12. juli. 2008 kl. 03.28 skrev Steve Piercy - Web Site Builder: > >> What does this show? >> >> inline: ....to get the record with id and return (field:'nid')... >> records; >> >> field('nid')'<br>'; >> >> // find this records images from another db >> >> --steve >> >> >> On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: >> >>> Hi list, >>> >>> I finally found out saving images from a FMSA 9 image container >>> field. >>> Problem is now that displaying each image works but when I save the >>> images it saves the image from the first found record. If found_count >>> is i.ex. 5 it saves 5 images that all are the first image >>> >>> inline: ....to get the record with id and return (field:'nid')... >>> records; >>> >>> // find this records images from another db >>> inline: -Database='Bilder',-InlineName='bilder', >>> -Layout='BilderLasso', >>> 'nid'= (field:'nid'), >>> -search; >>> /inline; >>> >>> records:-InlineName='bilder'; >>> if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); >>> Var: 'filedata' = (Database_FMContainer: 'Bilde'); >>> Var: 'image' = (Image: -Binary=$filedata); >>> $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >>> Quality=100); >>> /if; >>> /records; >>> >>> /records; >>> /inline; >>> >>> I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >>> but they all are the image from the first container field. >>> >>> /asle benoni >>> >>> >>> >> >> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >> Steve Piercy Web Site Builder Soquel, CA >> <web@...> <http://www.StevePiercy.com/> >> >> -- >> This list is a free service of LassoSoft: http://www.LassoSoft.com/ >> Search the list archives: http://www.ListSearch.com/Lasso/Browse/ >> Manage your subscription: http://www.ListSearch.com/Lasso/ >> > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Steve Piercy Web Site Builder Soquel, CA <web@...> <http://www.StevePiercy.com/> -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundHei Steve,
Here is the result when I comment til "IF" test to check if file exists; 121: No error 122: No error 123: No error 124: No error 125: No error 126: No error 127: No error 128: No error 129: No error So it seems it finds the correct KeyField_Value for the record it should fetch the image from. Still it writes the first image found 9 times here and not each image. Could it be something in FMSA9 setup? /asle benoni Steve Piercy - Web Site Builder wrote: > Hi Asle, > > Okay, so that confirms the assumption that you are returning the proper record set. > > I assume that you delete .jpg's from the directory '../storebilder/' every time before you run the script. > > I've commented the previous tests. I also commented the if.../if statement, just to see what will happen. This version should write each image to the file system. I also inserted an error statement to indicate whether file permissions are properly configured to write the image files. > > Prior to running the script, delete all the images from the directory '../storebilder/'. After running the script, see if you get the expected results. If so, then uncomment the if.../if statement, and repeat the test. > > Let us know how it goes. > > var:'nid' = (action_param:'nid'); > inline: -Database='NaRIn', > -Layout='phpliste', > -KeyValue= $nid, > -Search, > -MaxRecords='1'; > > records; > var:'narinid'= (field:'NaRInID'); > > inline: -Database='Bilder', > -Layout='BilderLasso', > 'NaRInID'= $narinid, > -Search; > // ($narinid)' found:' found_count; > records; > // '<br>'(KeyField_Value); > > // if(!(file_exists('storebilder/'(KeyField_Value)'.jpg'))); > var('image' = Image(-Binary=Database_FMContainer('Bilde'))); > $image->save('../storebilder/'(KeyField_Value)'.jpg',-Quality=100); > '<br>'(KeyField_Value)': 'file_currenterror; > // /if; > > /records; > /inline; > /records; > /inline; > > --steve > > > On Sunday, July 13, 2008, asle@... (Asle Benoni) pronounced: > > >> Hi Steve, >> Here is the code I tested: >> >> var:'nid' = (action_param:'nid'); >> inline: -Database='NaRIn', >> -Layout='phpliste', >> -KeyValue= $nid, >> -Search, >> -MaxRecords='1'; >> >> records; >> var:'narinid'= (field:'NaRInID'); >> >> inline: -Database='Bilder', >> -Layout='BilderLasso', >> 'NaRInID'= $narinid, >> -Search; >> ($narinid)' found:' found_count; >> records; >> '<br>'(KeyField_Value); >> /records; >> /inline; >> /records; >> /inline; >> >> Result: >> 1k6kKTdjnC found:9 >> 184 >> 185 >> 186 >> 188 >> 189 >> 192 >> 193 >> 194 >> 195 >> >> So I find the record, then pull out the field (NaRInID). Then I search >> the layout (Bilder) for matching records. As you see I found 9 records >> and the KeyField_Value of each picture. But the first picture (184) is >> written 9 times so all the pictures like 184.jpg is exactly the same >> as 186.jpg etc. >> >> Am I understandable? >> >> /asle benoni >> >> Den 12. juli. 2008 kl. 03.28 skrev Steve Piercy - Web Site Builder: >> >> >>> What does this show? >>> >>> inline: ....to get the record with id and return (field:'nid')... >>> records; >>> >>> field('nid')'<br>'; >>> >>> // find this records images from another db >>> >>> --steve >>> >>> >>> On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: >>> >>> >>>> Hi list, >>>> >>>> I finally found out saving images from a FMSA 9 image container >>>> field. >>>> Problem is now that displaying each image works but when I save the >>>> images it saves the image from the first found record. If found_count >>>> is i.ex. 5 it saves 5 images that all are the first image >>>> >>>> inline: ....to get the record with id and return (field:'nid')... >>>> records; >>>> >>>> // find this records images from another db >>>> inline: -Database='Bilder',-InlineName='bilder', >>>> -Layout='BilderLasso', >>>> 'nid'= (field:'nid'), >>>> -search; >>>> /inline; >>>> >>>> records:-InlineName='bilder'; >>>> if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); >>>> Var: 'filedata' = (Database_FMContainer: 'Bilde'); >>>> Var: 'image' = (Image: -Binary=$filedata); >>>> $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >>>> Quality=100); >>>> /if; >>>> /records; >>>> >>>> /records; >>>> /inline; >>>> >>>> I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >>>> but they all are the image from the first container field. >>>> >>>> /asle benoni >>>> >>>> >>>> >>>> >>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>> Steve Piercy Web Site Builder Soquel, CA >>> <web@...> <http://www.StevePiercy.com/> >>> >>> -- >>> This list is a free service of LassoSoft: http://www.LassoSoft.com/ >>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/ >>> Manage your subscription: http://www.ListSearch.com/Lasso/ >>> >>> >> > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > Steve Piercy Web Site Builder Soquel, CA > <web@...> <http://www.StevePiercy.com/> > > -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundHi Asle,
Okay, so we verified that file permissions are not an issue. Did you clear out the directory of images prior to running the script? If files exist, they might not get overwritten by the new, found data stored in the FM datasource's container field. Here are some possibilities to explain the results you receive. * The image stored in the FM datasource is the same image for all the found records. * The code sample we've exchanged in email differs significantly from what you have deployed. * There is a bug retrieving data from a FM container field within a found record set (very unlikely). Personally I'm stumped. Based on the code we've exchanged in email, I expect it would work as intended, just as you say. I mean, your code does the following: * Find records * For each record, store the binary data from the FM container field in a variable * Save the variable as a .jpg file It is simple and *should* work, so at least one of our assumptions must be wrong. --steve On Monday, July 14, 2008, asle@... (Asle Benoni) pronounced: >Hei Steve, >Here is the result when I comment til "IF" test to check if file exists; > >121: No error >122: No error >123: No error >124: No error >125: No error >126: No error >127: No error >128: No error >129: No error > >So it seems it finds the correct KeyField_Value for the record it should >fetch the image from. Still it writes the first image found 9 times here >and not each image. Could it be something in FMSA9 setup? > >/asle benoni > >Steve Piercy - Web Site Builder wrote: >> Hi Asle, >> >> Okay, so that confirms the assumption that you are returning the proper record >set. >> >> I assume that you delete .jpg's from the directory '../storebilder/' every time >before you run the script. >> >> I've commented the previous tests. I also commented the if.../if statement, just >to see what will happen. This version should write each image to the file system. >I also inserted an error statement to indicate whether file permissions are properly >configured to write the image files. >> >> Prior to running the script, delete all the images from the directory >'../storebilder/'. After running the script, see if you get the expected results. >If so, then uncomment the if.../if statement, and repeat the test. >> >> Let us know how it goes. >> >> var:'nid' = (action_param:'nid'); >> inline: -Database='NaRIn', >> -Layout='phpliste', >> -KeyValue= $nid, >> -Search, >> -MaxRecords='1'; >> >> records; >> var:'narinid'= (field:'NaRInID'); >> >> inline: -Database='Bilder', >> -Layout='BilderLasso', >> 'NaRInID'= $narinid, >> -Search; >> // ($narinid)' found:' found_count; >> records; >> // '<br>'(KeyField_Value); >> >> // if(!(file_exists('storebilder/'(KeyField_Value)'.jpg'))); >> var('image' = Image(-Binary=Database_FMContainer('Bilde'))); >> $image->save('../storebilder/'(KeyField_Value)'.jpg',-Quality=100); >> '<br>'(KeyField_Value)': 'file_currenterror; >> // /if; >> >> /records; >> /inline; >> /records; >> /inline; >> >> --steve >> >> >> On Sunday, July 13, 2008, asle@... (Asle Benoni) pronounced: >> >> >>> Hi Steve, >>> Here is the code I tested: >>> >>> var:'nid' = (action_param:'nid'); >>> inline: -Database='NaRIn', >>> -Layout='phpliste', >>> -KeyValue= $nid, >>> -Search, >>> -MaxRecords='1'; >>> >>> records; >>> var:'narinid'= (field:'NaRInID'); >>> >>> inline: -Database='Bilder', >>> -Layout='BilderLasso', >>> 'NaRInID'= $narinid, >>> -Search; >>> ($narinid)' found:' found_count; >>> records; >>> '<br>'(KeyField_Value); >>> /records; >>> /inline; >>> /records; >>> /inline; >>> >>> Result: >>> 1k6kKTdjnC found:9 >>> 184 >>> 185 >>> 186 >>> 188 >>> 189 >>> 192 >>> 193 >>> 194 >>> 195 >>> >>> So I find the record, then pull out the field (NaRInID). Then I search >>> the layout (Bilder) for matching records. As you see I found 9 records >>> and the KeyField_Value of each picture. But the first picture (184) is >>> written 9 times so all the pictures like 184.jpg is exactly the same >>> as 186.jpg etc. >>> >>> Am I understandable? >>> >>> /asle benoni >>> >>> Den 12. juli. 2008 kl. 03.28 skrev Steve Piercy - Web Site Builder: >>> >>> >>>> What does this show? >>>> >>>> inline: ....to get the record with id and return (field:'nid')... >>>> records; >>>> >>>> field('nid')'<br>'; >>>> >>>> // find this records images from another db >>>> >>>> --steve >>>> >>>> >>>> On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: >>>> >>>> >>>>> Hi list, >>>>> >>>>> I finally found out saving images from a FMSA 9 image container >>>>> field. >>>>> Problem is now that displaying each image works but when I save the >>>>> images it saves the image from the first found record. If found_count >>>>> is i.ex. 5 it saves 5 images that all are the first image >>>>> >>>>> inline: ....to get the record with id and return (field:'nid')... >>>>> records; >>>>> >>>>> // find this records images from another db >>>>> inline: -Database='Bilder',-InlineName='bilder', >>>>> -Layout='BilderLasso', >>>>> 'nid'= (field:'nid'), >>>>> -search; >>>>> /inline; >>>>> >>>>> records:-InlineName='bilder'; >>>>> if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); >>>>> Var: 'filedata' = (Database_FMContainer: 'Bilde'); >>>>> Var: 'image' = (Image: -Binary=$filedata); >>>>> $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >>>>> Quality=100); >>>>> /if; >>>>> /records; >>>>> >>>>> /records; >>>>> /inline; >>>>> >>>>> I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >>>>> but they all are the image from the first container field. >>>>> >>>>> /asle benoni >>>>> >>>>> >>>>> >>>>> >>>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>> Steve Piercy Web Site Builder Soquel, CA >>>> <web@...> <http://www.StevePiercy.com/> >>>> >>>> -- >>>> This list is a free service of LassoSoft: http://www.LassoSoft.com/ >>>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/ >>>> Manage your subscription: http://www.ListSearch.com/Lasso/ >>>> >>>> >>> >> >> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >> Steve Piercy Web Site Builder Soquel, CA >> <web@...> <http://www.StevePiercy.com/> >> >> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Steve Piercy Web Site Builder Soquel, CA <web@...> <http://www.StevePiercy.com/> -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundHei Steve,
- When I browse the table in FM client the picture is different in every "Bilde" field. If I save it directly from the client I get the correct image and not the same image every time as the Lasso code writes. - The code is as exact as I can copy it (without revealing security) - I sometimes get an error "FileMaker Server Advanced returned an error" on the search in the picture layout". When I refresh I get no error. I am not sure how to debug this but could this be something to look at? /asle benoni Steve Piercy - Web Site Builder wrote: > Hi Asle, > > Okay, so we verified that file permissions are not an issue. > > Did you clear out the directory of images prior to running the script? If files exist, they might not get overwritten by the new, found data stored in the FM datasource's container field. > > Here are some possibilities to explain the results you receive. > > * The image stored in the FM datasource is the same image for all the found records. > * The code sample we've exchanged in email differs significantly from what you have deployed. > * There is a bug retrieving data from a FM container field within a found record set (very unlikely). > > Personally I'm stumped. Based on the code we've exchanged in email, I expect it would work as intended, just as you say. I mean, your code does the following: > > * Find records > * For each record, store the binary data from the FM container field in a variable > * Save the variable as a .jpg file > > It is simple and *should* work, so at least one of our assumptions must be wrong. > > --steve > > > On Monday, July 14, 2008, asle@... (Asle Benoni) pronounced: > > >> Hei Steve, >> Here is the result when I comment til "IF" test to check if file exists; >> >> 121: No error >> 122: No error >> 123: No error >> 124: No error >> 125: No error >> 126: No error >> 127: No error >> 128: No error >> 129: No error >> >> So it seems it finds the correct KeyField_Value for the record it should >> fetch the image from. Still it writes the first image found 9 times here >> and not each image. Could it be something in FMSA9 setup? >> >> /asle benoni >> >> Steve Piercy - Web Site Builder wrote: >> >>> Hi Asle, >>> >>> Okay, so that confirms the assumption that you are returning the proper record >>> >> set. >> >>> I assume that you delete .jpg's from the directory '../storebilder/' every time >>> >> before you run the script. >> >>> I've commented the previous tests. I also commented the if.../if statement, just >>> >> to see what will happen. This version should write each image to the file system. >> I also inserted an error statement to indicate whether file permissions are properly >> configured to write the image files. >> >>> Prior to running the script, delete all the images from the directory >>> >> '../storebilder/'. After running the script, see if you get the expected results. >> If so, then uncomment the if.../if statement, and repeat the test. >> >>> Let us know how it goes. >>> >>> var:'nid' = (action_param:'nid'); >>> inline: -Database='NaRIn', >>> -Layout='phpliste', >>> -KeyValue= $nid, >>> -Search, >>> -MaxRecords='1'; >>> >>> records; >>> var:'narinid'= (field:'NaRInID'); >>> >>> inline: -Database='Bilder', >>> -Layout='BilderLasso', >>> 'NaRInID'= $narinid, >>> -Search; >>> // ($narinid)' found:' found_count; >>> records; >>> // '<br>'(KeyField_Value); >>> >>> // if(!(file_exists('storebilder/'(KeyField_Value)'.jpg'))); >>> var('image' = Image(-Binary=Database_FMContainer('Bilde'))); >>> $image->save('../storebilder/'(KeyField_Value)'.jpg',-Quality=100); >>> '<br>'(KeyField_Value)': 'file_currenterror; >>> // /if; >>> >>> /records; >>> /inline; >>> /records; >>> /inline; >>> >>> --steve >>> >>> >>> On Sunday, July 13, 2008, asle@... (Asle Benoni) pronounced: >>> >>> >>> >>>> Hi Steve, >>>> Here is the code I tested: >>>> >>>> var:'nid' = (action_param:'nid'); >>>> inline: -Database='NaRIn', >>>> -Layout='phpliste', >>>> -KeyValue= $nid, >>>> -Search, >>>> -MaxRecords='1'; >>>> >>>> records; >>>> var:'narinid'= (field:'NaRInID'); >>>> >>>> inline: -Database='Bilder', >>>> -Layout='BilderLasso', >>>> 'NaRInID'= $narinid, >>>> -Search; >>>> ($narinid)' found:' found_count; >>>> records; >>>> '<br>'(KeyField_Value); >>>> /records; >>>> /inline; >>>> /records; >>>> /inline; >>>> >>>> Result: >>>> 1k6kKTdjnC found:9 >>>> 184 >>>> 185 >>>> 186 >>>> 188 >>>> 189 >>>> 192 >>>> 193 >>>> 194 >>>> 195 >>>> >>>> So I find the record, then pull out the field (NaRInID). Then I search >>>> the layout (Bilder) for matching records. As you see I found 9 records >>>> and the KeyField_Value of each picture. But the first picture (184) is >>>> written 9 times so all the pictures like 184.jpg is exactly the same >>>> as 186.jpg etc. >>>> >>>> Am I understandable? >>>> >>>> /asle benoni >>>> >>>> Den 12. juli. 2008 kl. 03.28 skrev Steve Piercy - Web Site Builder: >>>> >>>> >>>> >>>>> What does this show? >>>>> >>>>> inline: ....to get the record with id and return (field:'nid')... >>>>> records; >>>>> >>>>> field('nid')'<br>'; >>>>> >>>>> // find this records images from another db >>>>> >>>>> --steve >>>>> >>>>> >>>>> On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: >>>>> >>>>> >>>>> >>>>>> Hi list, >>>>>> >>>>>> I finally found out saving images from a FMSA 9 image container >>>>>> field. >>>>>> Problem is now that displaying each image works but when I save the >>>>>> images it saves the image from the first found record. If found_count >>>>>> is i.ex. 5 it saves 5 images that all are the first image >>>>>> >>>>>> inline: ....to get the record with id and return (field:'nid')... >>>>>> records; >>>>>> >>>>>> // find this records images from another db >>>>>> inline: -Database='Bilder',-InlineName='bilder', >>>>>> -Layout='BilderLasso', >>>>>> 'nid'= (field:'nid'), >>>>>> -search; >>>>>> /inline; >>>>>> >>>>>> records:-InlineName='bilder'; >>>>>> if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); >>>>>> Var: 'filedata' = (Database_FMContainer: 'Bilde'); >>>>>> Var: 'image' = (Image: -Binary=$filedata); >>>>>> $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >>>>>> Quality=100); >>>>>> /if; >>>>>> /records; >>>>>> >>>>>> /records; >>>>>> /inline; >>>>>> >>>>>> I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >>>>>> but they all are the image from the first container field. >>>>>> >>>>>> /asle benoni >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>> Steve Piercy Web Site Builder Soquel, CA >>>>> <web@...> <http://www.StevePiercy.com/> >>>>> >>>>> -- >>>>> This list is a free service of LassoSoft: http://www.LassoSoft.com/ >>>>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/ >>>>> Manage your subscription: http://www.ListSearch.com/Lasso/ >>>>> >>>>> >>>>> >>>> >>>> >>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>> Steve Piercy Web Site Builder Soquel, CA >>> <web@...> <http://www.StevePiercy.com/> >>> >>> >>> > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > Steve Piercy Web Site Builder Soquel, CA > <web@...> <http://www.StevePiercy.com/> > > -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundHi Asle,
The only question you did not yet answer was this one: Did you clear out the directory of images prior to running the script? Check the file modification timestamps of images in the directory where you write them. Otherwise, I'm at a loss for other possibilities. --steve On Tuesday, July 15, 2008, asle@... (Asle Benoni) pronounced: >Hei Steve, > >- When I browse the table in FM client the picture is different in every >"Bilde" field. If I save it directly from the client I get the correct >image and not the same image every time as the Lasso code writes. > >- The code is as exact as I can copy it (without revealing security) >- I sometimes get an error "FileMaker Server Advanced returned an error" >on the search in the picture layout". When I refresh I get no error. >I am not sure how to debug this but could this be something to look at? > >/asle benoni > >Steve Piercy - Web Site Builder wrote: >> Hi Asle, >> >> Okay, so we verified that file permissions are not an issue. >> >> Did you clear out the directory of images prior to running the script? If files >exist, they might not get overwritten by the new, found data stored in the FM >datasource's container field. >> >> Here are some possibilities to explain the results you receive. >> >> * The image stored in the FM datasource is the same image for all the found >records. >> * The code sample we've exchanged in email differs significantly from what you >have deployed. >> * There is a bug retrieving data from a FM container field within a found record >set (very unlikely). >> >> Personally I'm stumped. Based on the code we've exchanged in email, I expect it >would work as intended, just as you say. I mean, your code does the following: >> >> * Find records >> * For each record, store the binary data from the FM container field in a variable >> * Save the variable as a .jpg file >> >> It is simple and *should* work, so at least one of our assumptions must be wrong. >> >> --steve >> >> >> On Monday, July 14, 2008, asle@... (Asle Benoni) pronounced: >> >> >>> Hei Steve, >>> Here is the result when I comment til "IF" test to check if file exists; >>> >>> 121: No error >>> 122: No error >>> 123: No error >>> 124: No error >>> 125: No error >>> 126: No error >>> 127: No error >>> 128: No error >>> 129: No error >>> >>> So it seems it finds the correct KeyField_Value for the record it should >>> fetch the image from. Still it writes the first image found 9 times here >>> and not each image. Could it be something in FMSA9 setup? >>> >>> /asle benoni >>> >>> Steve Piercy - Web Site Builder wrote: >>> >>>> Hi Asle, >>>> >>>> Okay, so that confirms the assumption that you are returning the proper record >>>> >>> set. >>> >>>> I assume that you delete .jpg's from the directory '../storebilder/' every time >>>> >>> before you run the script. >>> >>>> I've commented the previous tests. I also commented the if.../if statement, >just >>>> >>> to see what will happen. This version should write each image to the file >system. >>> I also inserted an error statement to indicate whether file permissions are >properly >>> configured to write the image files. >>> >>>> Prior to running the script, delete all the images from the directory >>>> >>> '../storebilder/'. After running the script, see if you get the expected >results. >>> If so, then uncomment the if.../if statement, and repeat the test. >>> >>>> Let us know how it goes. >>>> >>>> var:'nid' = (action_param:'nid'); >>>> inline: -Database='NaRIn', >>>> -Layout='phpliste', >>>> -KeyValue= $nid, >>>> -Search, >>>> -MaxRecords='1'; >>>> >>>> records; >>>> var:'narinid'= (field:'NaRInID'); >>>> >>>> inline: -Database='Bilder', >>>> -Layout='BilderLasso', >>>> 'NaRInID'= $narinid, >>>> -Search; >>>> // ($narinid)' found:' found_count; >>>> records; >>>> // '<br>'(KeyField_Value); >>>> >>>> // if(!(file_exists('storebilder/'(KeyField_Value)'.jpg'))); >>>> var('image' = Image(-Binary=Database_FMContainer('Bilde'))); >>>> $image->save('../storebilder/'(KeyField_Value)'.jpg',-Quality=100); >>>> '<br>'(KeyField_Value)': 'file_currenterror; >>>> // /if; >>>> >>>> /records; >>>> /inline; >>>> /records; >>>> /inline; >>>> >>>> --steve >>>> >>>> >>>> On Sunday, July 13, 2008, asle@... (Asle Benoni) pronounced: >>>> >>>> >>>> >>>>> Hi Steve, >>>>> Here is the code I tested: >>>>> >>>>> var:'nid' = (action_param:'nid'); >>>>> inline: -Database='NaRIn', >>>>> -Layout='phpliste', >>>>> -KeyValue= $nid, >>>>> -Search, >>>>> -MaxRecords='1'; >>>>> >>>>> records; >>>>> var:'narinid'= (field:'NaRInID'); >>>>> >>>>> inline: -Database='Bilder', >>>>> -Layout='BilderLasso', >>>>> 'NaRInID'= $narinid, >>>>> -Search; >>>>> ($narinid)' found:' found_count; >>>>> records; >>>>> '<br>'(KeyField_Value); >>>>> /records; >>>>> /inline; >>>>> /records; >>>>> /inline; >>>>> >>>>> Result: >>>>> 1k6kKTdjnC found:9 >>>>> 184 >>>>> 185 >>>>> 186 >>>>> 188 >>>>> 189 >>>>> 192 >>>>> 193 >>>>> 194 >>>>> 195 >>>>> >>>>> So I find the record, then pull out the field (NaRInID). Then I search >>>>> the layout (Bilder) for matching records. As you see I found 9 records >>>>> and the KeyField_Value of each picture. But the first picture (184) is >>>>> written 9 times so all the pictures like 184.jpg is exactly the same >>>>> as 186.jpg etc. >>>>> >>>>> Am I understandable? >>>>> >>>>> /asle benoni >>>>> >>>>> Den 12. juli. 2008 kl. 03.28 skrev Steve Piercy - Web Site Builder: >>>>> >>>>> >>>>> >>>>>> What does this show? >>>>>> >>>>>> inline: ....to get the record with id and return (field:'nid')... >>>>>> records; >>>>>> >>>>>> field('nid')'<br>'; >>>>>> >>>>>> // find this records images from another db >>>>>> >>>>>> --steve >>>>>> >>>>>> >>>>>> On Saturday, July 12, 2008, asle@... (Asle Benoni) pronounced: >>>>>> >>>>>> >>>>>> >>>>>>> Hi list, >>>>>>> >>>>>>> I finally found out saving images from a FMSA 9 image container >>>>>>> field. >>>>>>> Problem is now that displaying each image works but when I save the >>>>>>> images it saves the image from the first found record. If found_count >>>>>>> is i.ex. 5 it saves 5 images that all are the first image >>>>>>> >>>>>>> inline: ....to get the record with id and return (field:'nid')... >>>>>>> records; >>>>>>> >>>>>>> // find this records images from another db >>>>>>> inline: -Database='Bilder',-InlineName='bilder', >>>>>>> -Layout='BilderLasso', >>>>>>> 'nid'= (field:'nid'), >>>>>>> -search; >>>>>>> /inline; >>>>>>> >>>>>>> records:-InlineName='bilder'; >>>>>>> if: !(file_exists:'storebilder/'(KeyField_Value)'.jpg'); >>>>>>> Var: 'filedata' = (Database_FMContainer: 'Bilde'); >>>>>>> Var: 'image' = (Image: -Binary=$filedata); >>>>>>> $image->(Save:'../storebilder/'(KeyField_Value)'.jpg',- >>>>>>> Quality=100); >>>>>>> /if; >>>>>>> /records; >>>>>>> >>>>>>> /records; >>>>>>> /inline; >>>>>>> >>>>>>> I now get i.ex. 5 images, 101.jpg,102.jpg,103.jpg,104.jpg,105.jpg -- >>>>>>> but they all are the image from the first container field. >>>>>>> >>>>>>> /asle benoni >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>>>> Steve Piercy Web Site Builder Soquel, CA >>>>>> <web@...> <http://www.StevePiercy.com/> >>>>>> >>>>>> -- >>>>>> This list is a free service of LassoSoft: http://www.LassoSoft.com/ >>>>>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/ >>>>>> Manage your subscription: http://www.ListSearch.com/Lasso/ >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>>> Steve Piercy Web Site Builder Soquel, CA >>>> <web@...> <http://www.StevePiercy.com/> >>>> >>>> >>>> >> >> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >> Steve Piercy Web Site Builder Soquel, CA >> <web@...> <http://www.StevePiercy.com/> >> >> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Steve Piercy Web Site Builder Soquel, CA <web@...> <http://www.StevePiercy.com/> -- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/Lasso/Browse/ Manage your subscription: http://www.ListSearch.com/Lasso/ |
|
|
Re: Saving image from Database_FMcontainer saves only first foundSorry, I cleared the directory before running the script. The images
have all the same timestamp. I am baffled if that is what you call it. I think I have to try to recreate the FM layout. There must be something on the FMSA side. Also since I get the "FileMaker Server Advanced returned an error" on some records. Thans anyway for trying hard to help :-) I will post the solution when it eventually works. /asle benoni Steve Piercy - Web Site Builder wrote: > Hi Asle, > > The only question you did not yet answer was this one: > > Did you clear out the directory of images prior to running the script? Check the file modification timestamps of images in the directory where you write them. > > Otherwise, I'm at a loss for other possibilities. > > --steve > > > On Tuesday, July 15, 2008, asle@... (Asle Benoni) pronounced: > > >> Hei Steve, >> >> - When I browse the table in FM client the picture is different in every >> "Bilde" field. If I save it directly from the client I get the correct >> image and not the same image every time as the Lasso code writes. >> >> - The code is as exact as I can copy it (without revealing security) >> - I sometimes get an error "FileMaker Server Advanced returned an error" >> on the search in the picture layout". When I refresh I get no error. >> I am not sure how to debug this but could this be something to look at? >> >> /asle benoni >> >> Steve Piercy - Web Site Builder wrote: >> >>> Hi Asle, >>> >>> Okay, so we verified that file permissions are not an issue. >>> >>> Did you clear out the directory of images prior to running the script? If files >>> >> exist, they might not get overwritten by the new, found data stored in the FM >> datasource's container field. >> >>> Here are some possibilities to explain the results you receive. >>> >>> * The image stored in the FM datasource is the same image for all the found >>> >> records. >> >>> * The code sample we've exchanged in email differs significantly from what you >>> >> have deployed. >> >>> * There is a bug retrieving data from a FM container field within a found record >>> >> set (very unlikely). >> >>> Personally I'm stumped. Based on the code we've exchanged in email, I expect it >>> >> would work as intended, just as you say. I mean, your code does the following: >> >>> * Find records >>> * For each record, store the binary data from the FM container field in a variable >>> * Save the variable as a .jpg file >>> >>> It is simple and *should* work, so at least one of our assumptions must be wrong. >>> >>> --steve >>> >>> >>> On Monday, July 14, 2008, asle@... (Asle Benoni) pronounced: >>> >>> >>> >>>> Hei Steve, >>>> Here is the result when I comment til "IF" test to check if file exists; >>>> >>>> 121: No error >>>> 122: No error >>>> 123: No error >>>> 124: No error >>>> 125: No error >>>> 126: No error >>>> 127: No error >>>> 128: No error >>>> 129: No error >>>> >>>> So it seems it finds the correct KeyField_Value for the record it should >>>> fetch the image from. Still it writes the first image found 9 times here >>>> and not each image. Could it be something in FMSA9 setup? >>>> >>>> /asle benoni >>>> >>>> Steve Piercy - Web Site Builder wrote: >>>> >>>> >>>>> Hi Asle, >>>>> >>>>> Okay, so that confirms the assumption that you are returning the proper record >>>>> >>>>> >>>> set. >>>> >>>> >>>>> I assume that you delete .jpg's from the directory '../storebilder/' every time >>>>> >>>>> >>>> before you run the script. >>>> >>>> >>>>> I've commented the previous tests. I also commented the if.../if statement, >>>>> >> just >> >>>>> >> |