While working on a project last night, I had to do some image resizing on user upload, ie a user uploads his picture and the system had to keep the original and resize the image to 2 other sizes as well and save them on-disk. With ColdFusion, this surely sounds just a few lines of code – read the image with ImageRead, resize the image with ImageResize and write to disk with ImageWrite. Sounds easy. But there is a catch. If you are using sandbox security (which I guess most hosts do) – then you can run into a problem where the sandbox won’t allow read/write access to the temporary directories that ColdFusion uses to perform most of the Image operations.

I found this post here that helped me track the problem down after about an hour of troubleshooting. The solution is to add the temp directories to the ColdFusion sandbox. So, whatever your GetTempDirectory() is setup to, that directory needs to be in the ColdFusion sandbox.

Hope this post helps someone figure out the problem, sooner than I did.

Tagged with:  

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar
%d bloggers like this: