Advertisement
Advertisement
| 06.16.2008 at 11:42PM PDT, ID: 23490549 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: |
<!---
Create folder structure or change to fit your needs
Expects images to be uploaded to images and thumbnails go in thumbs
--->
<!--- set the full path to the images folder --->
<cfset mediapath = expandpath('./image')>
<!--- set the desired image height ---->
<cfset thumbsize = 75>
<!--- set the desired image width --->
<cfset imagesize = 320>
<cfif structKeyExists(form,"foto1") and len(form.foto1)>
<cffile action="upload"
filefield="foto1"
destination="#MediaPath#"
nameconflict="makeunique">
<!--- read the image ---->
<cfimage name="uploadedImage"
source="#MediaPath#/#file.serverFile#" >
<!--- figure out which way to scale the image --->
<cfif uploadedImage.width gt uploadedImage.height>
<cfset thmb_percentage = (thumbsize / uploadedImage.width)>
<cfset percentage = (imagesize / uploadedImage.width)>
<cfelse>
<cfset thmb_percentage = (thumbsize / uploadedImage.height)>
<cfset percentage = (imagesize / uploadedImage.height)>
</cfif>
<!--- calculate the new thumbnail and image height/width --->
<cfset thumbWidth = round(uploadedImage.width * thmb_percentage)>
<cfset thumbHeight = round(uploadedImage.height * thmb_percentage)>
<cfset newWidth = round(uploadedImage.width * percentage)>
<cfset newHeight = round(uploadedImage.height * percentage)>
<!--- see if we need to resize the image, maybe it is already smaller than our desired size --->
<cfif uploadedImage.width gt imagesize>
<cfimage action="resize"
height="#newHeight#"
width="#newWidth#"
source="#uploadedImage#"
destination="#MediaPath#/#file.serverFile#"
overwrite="true"/>
</cfif>
<!--- create a thumbnail for the image --->
<cfimage action="resize"
height="#thumbHeight#"
width="#thumbWidth#"
source="#uploadedImage#"
destination="#MediaPath#/thumb/#file.serverFile#"
overwrite="true"/>
<cfoutput>
<img src="image/thumb/#file.serverFile#" height="#thumbHeight#" width="#thumbWidth#" align="left" hspace="10"><br>
Original Image: #uploadedImage.width#x#uploadedImage.height#<br>
Resized Image: #newWidth#x#newHeight#<br>
Thumbnail: #thumbWidth#x#thumbHeight#<br><br>
<a href="image/#file.serverFile#">See Image</a><br>
</cfoutput>
</cfif>
<form action="test1.cfm" method="post" enctype="multipart/form-data">
<label for="fileUpload">Choose Image: </label>
<input type="file" name="foto1" id="foto1" />
<input type="submit" value="Upload Image">
</form>
|