开发者

Enforcing image width after upload

开发者 https://www.devze.com 2023-03-29 07:08 出处:网络
After doing a cffile action=\"upload\", I\'d like to check the width (assuming it\'s a image).I\'m currently using CF8.

After doing a cffile action="upload", I'd like to check the width (assuming it's a image). I'm currently using CF8.

Is there a built-in function开发者_StackOverflow to get the width of an image? If there's a built-in function in CF9, I guess I need to know that for when we update.


According to LiveDocs, the functionality exists in CF8.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_h-im_32.html#5164681

The example provided by Adobe should get you going:

<!--- This example shows how to retrieve information associated with the image. --->
<!--- Create a ColdFusion image from a JPEG file.--->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage">
<!--- Retrieve the information associated with the image. --->
<cfset info=ImageInfo(myImage)>
<cfdump var="#info#"></cfdump>
<p>height = <cfoutput>#info.height#</cfoutput>
<p>width = <cfoutput>#info.width#</cfoutput>
<p>source = <cfoutput>#info.source#"</cfoutput>
0

精彩评论

暂无评论...
验证码 换一张
取 消