[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

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!

7.2

Coldfusion - Upload an image, make thumb, write both to DB, show thumb in update employee form  page

Asked by MPEC_ADHD in Cold Fusion Markup Language, ColdFusion Studio

Tags: Coldfusion, Upload image, make thumb, write thumb and image to DB, show thumb in update employee form page

I have created an app in Coldfusion to where company employees can put their bios on the company website.


It starts with staff index.cfm (see screenshot) If an employee's image is missing they click on upload beside the missing image. This takes them to the upload page. They browse and upload the image and get sent back to staffindex.cfm to supposedly see the new image show up under the correct employee.

I need to write the image and thumb to the database and save the images in their respective folders: staffimages/thumbs
and staffimages/medium, (another directory on the same level) then show staffindex.cfm with the newly uploaded image showing beside the correct employee

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:
<cfset thisDir = expandPath(".")> 
<!--- Determine whether the form is uploaded with the image. ---> 
<cfif structKeyExists(form,"uploadedimage") and len(trim(form.uploadedimage))> 
    <!--- Use the cffile tag to upload the image file. ---> 
    <cffile action="upload" 
    	fileField="uploadedimage" 
        destination="#thisDir#" 
        result="fileUpload" 
        nameconflict="overwrite"> 
    <!--- Determine whether the image file is saved. ---> 
    <cfif fileUpload.fileWasSaved> 
    <!--- Determine whether the saved file is a valid image file. ---> 
        <cfif IsImageFile("#fileUpload.serverfile#")> 
    <!--- Read the image file into a variable called myImage. ---> 
            <cfimage action="read" source="#fileUpload.serverfile#" name="myuploadedimage"> 
            <!--- Determine whether the image file exceeds the size limits. ---> 
            <cfif ImageGetHeight(myuploadedimage) gt 1600 or ImageGetWidth(myuploadedimage) gt 1600> 
                <!--- If the file is too large, delete it from the server. ---> 
                <cffile action="delete" 
                    file="#fileUpload.serverDirectory#/#fileUpload.serverFile#"> 
                <cfoutput> 
                <p> 
                The image you uploaded was too large. It must be less than 800 pixels wide 
                    and 800 pixels high. Your image was #imageGetWidth(myuploadedimage)# pixels wide 
                    and #imageGetHeight(myuploadedimage)# pixels high.                </p> 
                </cfoutput> 
                <!--- If the image is valid and does not exceed the size limits, 
                    create a thumbnail image from the source file that is 75-pixels 
                    square, while maintaining the aspect ratio of the source image.  
                    Use the bilinear interpolation method to improve performance. 
                    ---> 
            <cfelse> 
 
    <cfset ImageScaleToFit(myuploadedimage,75,75,"bilinear")> 
                <!--- Specify the new filename as the source filename with 
                    "_thumbnail" appended to it. ---> 
                <cfset newImageName = fileUpload.serverDirectory & "/" & 
                    fileUpload.serverFilename & "_thumbnail." & 
                    fileUpload.serverFileExt> 
                <!--- Save the thumbnail image to a file with the new filename. ---> 
                <cfimage source="#myuploadedImage#" action="write" 
                    destination="#newImageName#" overwrite="yes"> 
                <cfoutput> 
                <p> 
                Thank you for uploading the image. We have created a thumbnail for 
                    your picture.                </p> 
                <p> 
                <!--- Display the thumbnail image. --->
                <img src="#getFileFromPath(newImageName)#" /></p> 
              </cfoutput>     
            </cfif> 
        <!--- If it is not a valid image file, delete it from the server. ---> 
        <cfelse> 
            <cffile action="delete" 
                file="#fileUpload.serverDirectory#/#fileUpload.serverFile#"> 
            <cfoutput> 
            <p> 
            The file you uploaded, #fileUpload.clientFile#, was not a valid image.            </p> 
            </cfoutput> 
        </cfif> 
    </cfif> 
</cfif>
Attachments:
 
this is the staffindex page that I am queing from
this is the staffindex page that I am queing from
 
[+][-]08/14/09 12:53 AM, ID: 25095927Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Cold Fusion Markup Language, ColdFusion Studio
Tags: Coldfusion, Upload image, make thumb, write thumb and image to DB, show thumb in update employee form page
Sign Up Now!
Solution Provided By: myselfrandhawa
Participating Experts: 1
Solution Grade: A
 
[+][-]08/09/09 07:42 PM, ID: 25056865Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/10/09 11:23 AM, ID: 25062516Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/10/09 04:34 PM, ID: 25065071Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/10/09 05:09 PM, ID: 25065276Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/10/09 05:11 PM, ID: 25065283Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/11/09 07:50 AM, ID: 25069716Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/11/09 09:28 AM, ID: 25070792Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/11/09 07:32 PM, ID: 25075300Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/13/09 08:42 PM, ID: 25095107Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/13/09 08:52 PM, ID: 25095143Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/13/09 09:23 PM, ID: 25095247Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/14/09 12:52 AM, ID: 25095920Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/14/09 08:14 AM, ID: 25098897Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/14/09 08:34 AM, ID: 25099168Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/14/09 09:02 AM, ID: 25099564Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/14/09 10:35 AM, ID: 25100408Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/14/09 10:44 AM, ID: 25100462Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/14/09 11:09 AM, ID: 25100713Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625