AnsweredAssumed Answered

Export all photos from container

Question asked by BenT on Jun 1, 2015
Latest reply on Jun 1, 2015 by philmodjunk

Title

Export all photos from container

Post

Hey all,

So for the sake of understanding, I've got three values: PictureID, PictureLarge (the container), and ScanID.

         
  • Picture ID is a newly generated number with each picture. 
  •      
  • PictureLarge is the container housing the entire image
  •      
  • ScanID is a 6 digit identifier that represents one item

The idea here is that in order to have multiple pictures on one item, but for them to be related, the ScanID must be the same.

For example, say I have 3 ScanID's, and thus 3 products. Each ScanID has multiple "PictureLarge" containers equal to the amount of photos stored for that item. Again, each picture has a unique PictureID. All of these are contained within their own table called "Pictures" ... where "ScanID" is related to the other tables in our database.

I've been writing a script that would allow someone to export all of the photos (PictureLarge), from one ScanID into a folder on the desktop called "FMExports", with a subfolder being the ScanID, and the filename being the unique PictureID.

I've attached a photo of what my script looks like thus far.

You'll notice at the top I have a value "Scans:ScanID" ... this is the relational value to "Pictures:ScanID". My thinking was that I could run a loop statement setting the $check variable to the active ScanID (which item am I looking at with all the pictures?), then when the script ran, it would end if the ScanID went to the next product.

A little more details:

In the one example I'm working with, I have three products, 213506, 213507, 213508. The first item has no pictures. The second, has 9, and the last one, 15. 

If I run the script while looking at the first item, with no pictures, it exports to the 213508 folder with the first 7 pictures. I suspect this is because the view that the script changes to shows all 24 records, and doesn't have the photos sorted by ScanID. If I run the script on the second ScanID, it exports all 9 photos nicely. If I run it on the third ScanID, it only exports 7 - again, I suspect because the list isn't sorted. 

Any suggestions? Should I redo the "If" statement to run through all the photo records (in this case, 24), and only export if Scans:ScanID=Pictures:ScanID?

 

Screen_Shot_2015-06-01_at_3.29.14_PM.png

Outcomes