1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Resize and upload the Image Error (Could not find the ColdFusion Component)

Discussion in 'Programming' started by BitMore, Sep 13, 2009.

  1. #1
    Hi,
    I have following code on my website, which resize and rename the image and upload to the Images folder. It works fine on old web server, but stop working on new server.

    It gives this error
    I have following code:-
    
    <cfset Image1 = createuuid()>
    <cfset Image1 = #Image1# & ".jpg">
    
    <cffile action="upload" filefield="file" destination="#imageFolderPath#" nameconflict="MakeUnique" accept="image/*">
    			
    <cffile action="rename" source="#imageFolderPath#/#cffile.ServerFile#" destination="#imageFolderPath#/#Image1#">
    			
    			
    <!--- create the object --->
    <cfset myImage = CreateObject("Component","Image") />
    <cfset myImage = CreateObject('Component', 'Image').setKey('68DPN-P2M2E-X8CRC-7DBVA-RXXB0') />
    		
    <!--- open the image to resize --->
    <cfset myImage.readImage(imageFolderPath & Image1) />
    
    <cfset width = myImage.getWidth() />
    
    <cfif width gt 740>
    <!--- resize the image proportionally on the width --->
    <cfset myImage.scaleWidth(740) />
    </cfif>
    	
    <cfset height = myImage.getHeight() />
    <cfif height gt 520>
    <!--- resize the image proportionally on the height --->
    <cfset myImage.scaleHeight(520) />
    </cfif>
    		
    <!--- output the image in JPG format --->
    <cfset myImage.writeImage(imageFolderPathE & 'A' & Image1, "jpg") />
    
    Code (markup):
    Thanks for Help
     
    BitMore, Sep 13, 2009 IP
  2. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Without knowing anything about your paths or mappings, the error suggests a missing mapping. If you have upgraded versions ie 6/7 to CF8, also check into reserved words. I'm not sure if "Image" is one ...
     
    cfStarlight, Sep 14, 2009 IP
  3. Paul_K

    Paul_K Greenhorn

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #3
    Is the Image.cfc present?

    <cfset myImage = CreateObject("Component","Image") />
     
    Paul_K, Sep 15, 2009 IP
  4. BitMore

    BitMore Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have searched, and there is no Image.cfc present. Then i have searched the backup files (from old server) and i could not find either.

    I am sure the developer didn't use the Image.cfc file on old server. Any way how to program it where i need to place. can you help bacause every page with Image upload produce the same error.

    Please help.
     
    BitMore, Sep 19, 2009 IP
  5. Paul_K

    Paul_K Greenhorn

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #5
    Paul_K, Sep 19, 2009 IP
  6. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Your code suggests otherwise. AFAIK, createObject("component", ....) can only be used to create a CFC. In which case somewhere in the standard CF paths _is_ an Image.cfc. Where it's located (subfolder, custom tag folder or somewhere else...) I couldn't say.

    It sounds a bit like the Alagad Image.cfc which is typically stored in one of the custom tag folders , where most people forget to look.. (See CF Admin for your custom tag paths ...)

    http://www.alagad.com/projects.imageComponent
     
    cfStarlight, Sep 19, 2009 IP