Rotating an image in Coldfusion and updating the file

Viewed 135

I need to rotate an image in Coldfusion and then once rotated it updated the file with the new rotation. So far this is what I have:

<cfimage source="../imgupload/image1.jpg" name="myImage">
<cfset ImageRotate(myImage,90,"bicubic")>
<cfimage source="#myImage#" destination="image1.jpg" action="write" overwrite="yes">
<img src="../imgupload/image1.jpg" width="600">

However, when the file is displayed on the 4th line, it shows the original "non-rotated" image. Any help would be appreciated.

Regards Sam

1 Answers

Change the file path on line 3 or on line 4.

Since you are watching an image from the source folder

<cfimage source="../imgupload/image1.jpg" name="myImage">
<cfset ImageRotate(myImage,90,"bicubic")>
<cfimage source="#myImage#" destination="../imgupload/image1.jpg" action="write" overwrite="yes">
<img src="../imgupload/image1.jpg" width="600">

OR

<cfimage source="../imgupload/image1.jpg" name="myImage">
<cfset ImageRotate(myImage,90,"bicubic")>
<cfimage source="#myImage#" destination="image1.jpg" action="write" overwrite="yes">
<img src="image1.jpg" width="600">
Related