npaadmin Posted November 2, 2007 Posted November 2, 2007 Hi Guys, Hope you can offer some insight. I have a container field that we use to store photographs of our locations. We have a policy where photos are supposed to be resized to 640x480px, it's not a structured policy in filemaker, it's just a "We know how to do it" thing. Our users here use photoshop to resize the images and then insert them into this container field. I have two questions: 1. Can I have that container field validate in some way so we don't get photos that are over 640x480px? For example, if someone put a photo in that was 1600x1200, they would get a message stating, "This photo is too large, please resize to 640x480!" 2. Is there a way to just have the container field resize the image automatically without any user intervention? If they dump a photo that is 1600x1200, can Filemaker just auto-resize it somehow? I would love to at least have the question one scenario setup, that would help with some of the new employees we have starting. It's a nice preventative measure. I thank you in advance!
IdealData Posted November 2, 2007 Posted November 2, 2007 1. Try Length (Container). It should return the size of the image in bytes. 2. Not that I know of. 3. Have a look at Troi file plug in. HTH
Søren Dyhr Posted November 2, 2007 Posted November 2, 2007 As long as you images are referenced, not embedded could the trick from this template be used: http://www.databasepros.com/FMPro?-DB=resources.fp5&-lay=cgi&-format=list.html&-FIND=+&resource_id=DBPros000518 ....as well as the behaviour of: http://www.filemaker.com/help/FunctionsRef-351.html ...when dealing with a containerfield with referenced data! It means making an extra field resposible for the validation process, so the checkbox in the lower left corner should be lifted. The rest is plain and simple filtering/massage until you get the data you need... oh! One more thing you need to stach the validation field as 1 pix x 1 pix.... somewhere on the layout in question, otherwise will the process not work. --sd asdasas.zip
comment Posted November 2, 2007 Posted November 2, 2007 As long as you images are referenced, not embedded ... ... and inserted individually - not imported as folder. Try Length (Container). It should return the size of the image in bytes. The size of the image FILE has very little to do with the size of the image. While Filemaker itself cannot resize the actual image, it should be relatively easy to do so by running an AppleScript.
Søren Dyhr Posted November 2, 2007 Posted November 2, 2007 Good reservations indeed, when the speach comes to rezising images could you utilize the operating systems image-events and do something in the vicinity of: http://www.macosxhints.com/article.php?story=2004092804461334 With some spit and polish could it be transformed into an embedded applescript instead of being a droplet. --sd
comment Posted November 2, 2007 Posted November 2, 2007 True, and with a bit more work it could work on embedded images as well (export, check size + resize if needed, re-embed, destroy). However, one should bear in mind that resizing images, esp. compressed ones, is an art. Leaving it to a pre-defined mechanized process may lead to some serious artifacts.
npaadmin Posted November 2, 2007 Author Posted November 2, 2007 In reading all the posts I am still a bit confused. If Container A holds my picture (And they are embedded, NOT referenced) and I want to make sure that Container A does not exceed 400k, how do I make it do that? Is it a validation calculation? And if it is, how do you tell that field not to exceed 400k? Thanks,
Fenton Posted November 2, 2007 Posted November 2, 2007 Validation of the container field: Length (container field)/1024 ≤ 400 Do not allow user override. But, you need to decide what your stategy will be. 1. Stop the user from inserting it, and leave it up to them to find, resize and re-insert the image. or 2. Resize it for them, using AppleScript. Actually, AppleScript could also assist with #1 also. If you used AppleScript to choose file, then called an Insert script in FileMaker, the AppleScript could reveal or open the original image, so they could resize it manually, then try again. But at that point why not just let AppleScript resize the image? It could do this on a copy of the image, leaving the original as it. It could then remove the file copy. Since you are embedding the image, and can resize the file used for that to your specifications, the original file can be left as is.
npaadmin Posted November 30, 2007 Author Posted November 30, 2007 I setup the calculation as you suggested and it works, it prevents a user from being able to insert a photo larger then 400k. The one question I have now is, in your calculation, Length (container field)/1024 ≤ 400, what does the "1024" represent? And how did you come to use "1024" in your calc? Thanks,
Fenton Posted November 30, 2007 Posted November 30, 2007 1024 is the number of Bytes in a "Kilobyte". It is not 1000, as we commonly assume; because it is a base 2 system. At least that's my understanding, and I've seen it in other places. Same up the line, 1 MB = 1024K
npaadmin Posted November 30, 2007 Author Posted November 30, 2007 Well, that makes sense. When you use the "/" in a calculation, what does that do?
Recommended Posts
This topic is 6263 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now