image.cfc - workaround for a missing 'mode' attribute in the <cfimage> tag
Description
There can be problems with deleting files ("standard" and "thumbnail" images) from the image library under a Linux/Unix enviroment. These problems are caused by the Unix file rights, which are created by the <cfimage> tag in the 'image.cfc' (normally "644"). Essentially this is caused by a missing 'mode' attribute in the <cfimage> tag.
This small workaround in the 'image.cfc' works for me. I only placed the following code after each <cfimage> tag:
<!--- Workaround for missing 'mode' attribute in the <cfimage> tag :: Set UNIX file rights to 'user:group' ---> <cffile action="rename" source="#imageDestination#" destination="#imageDestination#" mode="664" />
Code-Example from line 1512 on (image.cfc / SVN-Revision 11448): ---------------------------------------------------------------
<cfif arguments.ResizeMethod eq "none"> <cfif bModified> <cfimage action="write" source="#newImage#" destination="#imageDestination#" overwrite="true" /> <!--- Workaround for missing 'mode' attribute in the <cfimage> tag :: Set UNIX file rights to 'user:group' ---> <cffile action="rename" source="#imageDestination#" destination="#imageDestination#" mode="664" /> <cfelse> <!--- No changes, the file is already in place ... we're done ---> </cfif> <cfelse> <cfscript> stImageAttributeCollection.action = "write"; stImageAttributeCollection.source = newImage; stImageAttributeCollection.destination = imageDestination; stImageAttributeCollection.overwrite = "true"; if(right(imageDestination, 4) eq ".jpg" or right(imageDestination, 5) eq ".jpeg"){ stImageAttributeCollection.quality = arguments.quality; // This setting (from Adobe) is for jpg images only and would cause errors if used on other image types } </cfscript>
<cfimage attributeCollection="#stImageAttributeCollection#" /> <!--- Workaround for missing 'mode' attribute in the <cfimage> tag :: Set UNIX file rights to 'user:group' ---> <cffile action="rename" source="#imageDestination#" destination="#imageDestination#" mode="664" />
There can be problems with deleting files ("standard" and "thumbnail" images) from the image library under a Linux/Unix enviroment. These problems are caused by the Unix file rights, which are created by the <cfimage> tag in the 'image.cfc' (normally "644"). Essentially this is caused by a missing 'mode' attribute in the <cfimage> tag.
This small workaround in the 'image.cfc' works for me. I only placed the following code after each <cfimage> tag:
<!--- Workaround for missing 'mode' attribute in the <cfimage> tag :: Set UNIX file rights to 'user:group' --->
<cffile action="rename" source="#imageDestination#" destination="#imageDestination#" mode="664" />
Code-Example from line 1512 on (image.cfc / SVN-Revision 11448):
---------------------------------------------------------------
<cfif arguments.ResizeMethod eq "none">
<cfif bModified>
<cfimage action="write" source="#newImage#" destination="#imageDestination#" overwrite="true" />
<!--- Workaround for missing 'mode' attribute in the <cfimage> tag :: Set UNIX file rights to 'user:group' --->
<cffile action="rename" source="#imageDestination#" destination="#imageDestination#" mode="664" />
<cfelse>
<!--- No changes, the file is already in place ... we're done --->
</cfif>
<cfelse>
<cfscript>
stImageAttributeCollection.action = "write";
stImageAttributeCollection.source = newImage;
stImageAttributeCollection.destination = imageDestination;
stImageAttributeCollection.overwrite = "true";
if(right(imageDestination, 4) eq ".jpg" or right(imageDestination, 5) eq ".jpeg"){
stImageAttributeCollection.quality = arguments.quality; // This setting (from Adobe) is for jpg images only and would cause errors if used on other image types
}
</cfscript>
<cfimage attributeCollection="#stImageAttributeCollection#" />
<!--- Workaround for missing 'mode' attribute in the <cfimage> tag :: Set UNIX file rights to 'user:group' --->
<cffile action="rename" source="#imageDestination#" destination="#imageDestination#" mode="664" />
<cfset stResult.filename = listlast(stImageAttributeCollection.destination,"/\") />
</cfif>
---------------------------------------------------------------