13 Replies Latest reply on Feb 23, 2013 3:46 PM by vcarl

    Import image to container field

    vcarl

      I am using FM 11v.4 with mac os 10.6.8. I have a database containing 832 records and an image has been associated with each entry in a container field, using (store only a reference to the file). I would like to store the image file within the database, rather than the reference only. Is there a way to convert the existing data base without making the change from within each record? thanks Vince

        • 1. Re: Import image to container field
          reelsteve

          Create another container field, setting this one to store the file rather than reference.  Create (or use existing) layout which u can view all records, then create a script or a button with a single script step that calls replace field contents.  Set the target to ur new field, and the src to ur referenced container field.  Check the box so it doesn't nag u each record.  Press the button.  Should be good.  Save a copy of ur base bfrhand.

           

          Buenos Suerte,

          Steve

          1 of 1 people found this helpful
          • 2. Re: Import image to container field
            vcarl

            That sounds possible, I'll be giving it a try.  Thank you,  Vince

            • 3. Re: Import image to container field
              vcarl

              Steve, I have set up a new container field, and begun to create a button and or script.  I have set the target field to the new container, I don't see an option to select the source? (referenced container field).  It looks like this will replace all 832 records with one 'like' image.  In my case each record has a different image associated with it.

              • 4. Re: Import image to container field
                reelsteve

                The last of the three options replace field contents gives you is to replace by calculation.

                This is what u want.  U r replacing the contents of the newly created container (which is going to be empty in all records), with the contents of ur original container (which referenced a file).

                In the calculation, u just need to enter the fieldname for the original field.

                In answer to ur last question, if u check the Box to do without prompting you, it will shred thru the entire found set and replace the field in all records without asking u.  When the script ends, u will be left with all of ur records containing the file each record previously referenced, stored in ur new container field.  Once u have verified that all went well, u will be able to erase ur old field and just keep the new one. 

                If u want to step thru the script one at a time, don't check the box.

                Happy to send a quick demo if u want to look at what I'm talking about.

                Best, Steve

                • 5. Re: Import image to container field
                  vcarl

                  Steve,

                   

                  Thanks for the answer, I think I follow your explaination.  If it is not too much trouble your demo may be helpful. 

                   

                  thank you for your help,  Vince

                  • 6. Re: Import image to container field
                    taylorsharpe

                    FYI, FileMaker 12 completely reworked how container fields work so that it feels like you have stored a binary file in a container field when it is really stored externally in a secure folder.  It keeps the file small and nimble while making sure the image does not loose its reference location. If you have to do much with container fields, you should reallly consider upgrading to FileMaker 12. 

                     

                    Also, if you play with images much, there are some great image plugins.  I recently started using the Monkey Bread Software plugin for image manipulation.  For example, it can evaluate the size of your image and if it is too big, it can reduce the pixels or it can increase the compression.  It can convert between several images types (jpg, png, gif....).  And one feature I like a lot is the ability to rotate a picture inside the container field.  The MBS plugin does many other things and has about 1200 functions, but the image functions by themselves are worth the cost to me.  One more thing, FileMaker makes pushing out plugins to client machines much easier than the old Auto Update in FM 11. 

                     

                    Best of luck with it and let us know if anything doesn't work. 

                    • 7. Re: Import image to container field
                      reelsteve

                      Heres a demo.

                      I had to modify my original advice as the result it produced was referenced as well, not stored.

                      I'm so used to handling container data using fm12 that I had to fire up 11 and poke at it a bit.

                      i left both approaches in the demo so you can see what I am talking about.

                      for what you are trying to do, I would give some thought to upgrading to 12.

                      the container system is much more robust and was designed to meet this very need.

                      you may find that your solution starts to get slow as you load up files.

                      but - depending on your forecasted load, it may work just fine. 

                      in any event, hope this gives you some ideas on approaching your goal.

                       

                      best,

                      steve

                      1 of 1 people found this helpful
                      • 8. Re: Import image to container field
                        vcarl

                        Steve,

                         

                        I'll have to take a closer look at this, at a glance it looks good.  I want to study the scripts and adapt it for my application.  Thank you for walking me through. 

                         

                        regards,  Vince

                        • 9. Re: Import image to container field
                          vcarl

                          Steve,

                           

                          I am working through the scripts editor trying to adapt (insertimage_found Set) for my data base.

                           

                          In the fourth row in script editor you have "#".  I am not familiar with this function nor can I find a way to enter it into my script.  Would you school me about this?

                           

                          I've been giving some thought to FM 12, I have 11 running on 2 machines, not sure if I should upgrade both at this time.

                           

                          thank you, Vince

                          • 10. Re: Import image to container field
                            reelsteve

                            The # is first character of the comment function.  I use it to divide up script blocks into logical "blocks".

                            If u dbl click on it and start typing , these comments will be inserted.

                            It is completely benign and not needed.

                            Were u able to use the insert script to get ur files onboard ?

                            • 11. Re: Import image to container field
                              vcarl

                              Upon completing my script and implementing it I immediately get this dialog box.   The file "$file" could not be found and is required to complete this operation.  Then the dialog box; The previous script step, “Insert Picture”, could not be completed because of an error.  Do you wish to continue with this script?  The loop continues or click cancel.

                               

                              In the script the line Set Variable [$file;Value:replacefieldcontents::referencedContent] if you click the Specify button, a box titled "Set Variable" Options appears, here in the line, Name: I have entered  $file .

                              In the line Value:  I have clicked Specify and chosen my referenced field.  In my case it open the calcutations dialog box and the variable looks like  Art Data '04::Pict .  (this is my data base name :: and the referenced container field)

                               

                              In the "Insert picture" line click specify, Specify Picture File dialog box pops up, $file appears in the box, clicked OK.  It appears the same when I look through your scripts for (replacefiledcontents). 

                               

                              So somewhere I have made a mistake, be darned if I can find it.

                               

                              The  insertImage (all records) script [insertimage_foundSet] is the script I have been working from and the result has been the the two dialog boxes I referenced at the beginning of this reply.

                               

                              thanks Steve, Vince

                              • 12. Re: Import image to container field
                                reelsteve

                                hmmm....it sounds like the script is getting tipped over on the first step looking for the file.  when it can't find it- it is causing all the subsequent steps to fire without their needed variable value intact.  if you want me to take a look at it, I'd be happy to...you cld send it to me without the files.

                                reelsteve@mac.com

                                • 13. Re: Import image to container field
                                  vcarl

                                  Thank you I will be sending it off soon.  Vince