ImageDimensions function is not returning any results


Hey guys,

I am having a problem getting the imagedimensions( function to give me any results. I am dragging a .jpg to a drag receiver, renaming it, then trying to get the dimensions. It is being renamed (code not shown), but I can’t get the size. Consider the following code:

dropimagesfromfinder |||field="ImagePath" currentrecord=oneimage HFS=yes message=no|||

local photoRect,lht,lwdth
photoRect=imagedimensions(“Macintosh HD:Users:me:Pictures:mypicture.jpg”)
message photoRect
message lht
message lwdth

The first message is blank; the rest are 0. The path is correct and the picture with the new name exists. Am I missing something?



Change your code to use a UNIX path instead of an HFS path. You can get the correct UNIX path into your procedure by highlighting the file in the Finder and dragging it into your procedure or you can convert the existing HFS path using the unixpath( function as shown below:

photoRect=imagedimensions(unixpath(“Macintosh HD:Users:me:Pictures:mypicture.jpg”))


Thanks Gary, I think that worked. I was thrown off by the first line of code. I thought setting the HFS option to “yes” would work throughout the procedure. I’m not sure why it doesn’t.


That option is an option on the dropimagesfromfinder statement, it doesn’t affect anything but that one statement. The rest of the procedure knows nothing about the options set in other statements.

Most (all?) older file access functions will accept either HFS or UNIX file paths. This is to maintain compatibility with older programs written on the older system. For new code, I recommend switching to UNIX file paths. In most cases, I’ve even gone back and switched older code to use UNIX file paths, I think it is simpler that way.

The imagedimension( function is new to Panorama X, so there is no need for backwards compatibility. Any code that uses this function must be new. So it only works with UNIX paths.