Solved

cfimage resize

Posted on 2010-11-20
11
450 Views
Last Modified: 2012-05-10
win 2003 / Railo 3.1

I get this error: Can't cast Object type [Query] to a value of type [Image] when trying to run the following code:

<cfdirectory directory="C:\Inetpub\wwwroot\pics\unzipped\" name="picFiles">
<cfloop query="picFiles">  
<cfimage  
    action = "resize"
    height = "260"
    source = "C:\Inetpub\wwwroot\pics\unzipped\#picfiles.Name#"
    destination = "C:\Inetpub\wwwroot\pics\staging\#Picfiles.Name#"
    overwrite ="yes">
    </cfloop>

I cant figure it out.
Any help appreciated!
0
Comment
Question by:Bang-O-Matic
  • 7
  • 4
11 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 34181689
Stupid question, but .. is that the exact code you're running? Because the snippet works perfectly for me.  
0
 

Author Comment

by:Bang-O-Matic
ID: 34181798
Yes it is.  I'm thinking it must be an issue with Railo?
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34181835
Must be. Though it looks right and runs fine for me with Railo 3.1.2.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34181850
Slight correction. The cfdirectory is missing an explicit action="list". So you may as add it.  Can't hurt.
0
 

Author Comment

by:Bang-O-Matic
ID: 34183065
Had already tried action="list", heres the complete error Im getting:

Railo 3.1.2.001 Error (Expression)
Message Can't cast Object type [Query] to a value of type [Image]
Detail Java type of the object is railo.runtime.type.QueryImpl
Stacktrace The Error Occurred in
C:\Inetpub\wwwroot\resize.cfm: line 17
 
Java Stacktrace Can't cast Object type [Query] to a value of type [Image]
      at railo.runtime.img.Image.createImage(Image.java:1286):1286
      at railo.runtime.tag.Image.doStartTag(Image.java:312):312
      at resize_cfm$cf.call(C:\Inetpub\wwwroot\GAMLS\resize.cfm:17):17
      at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:620):620
      at railo.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:35):35
      at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:24):24
      at railo.runtime.PageContextImpl.execute(PageContextImpl.java:1709):1709
      at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:261):261
      at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32):32
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:91):91
      at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103):103
      at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187):187
      at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265):265
      at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273):273
      at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682):682
      at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743):743
      at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662):662
      at java.lang.Thread.run(Unknown Source):-1

 
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 52

Expert Comment

by:_agx_
ID: 34183790
I tested with almost same version, and don't get that error. Let me try it with 3.1.2.001 and see if there's a difference.  
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 34183967
Nope. The test code below worked fine with 3.1.2.001 too.  

The only other thing I can think of is the obvious. ie Dump the cfdirectory query and make sure it contains the results you think it does (images only, no directories, etc...).   Beyond that, I'm out of ideas.  Maybe something's hosed with your Railo install?

<!--- show the version --->
<cfdump var="#server#">
<!--- get file listing. NOTE this assumes the directory *only* contains images --->
<cfdirectory action="list" directory="C:\images" name="picFiles">
<!--- display query results --->
<cfdump var="#picFiles#">
<!--- attempt resize ..--->
<cfloop query="picFiles">
      <cfoutput>#picFiles.Name#</cfoutput><br>  
      <cfimage  
          action = "resize"
          height = "260"
          source = "C:\test\images\#picfiles.Name#"
          destination = "C:\test\staging\#Picfiles.Name#"
          overwrite ="yes">
</cfloop>
0
 

Author Closing Comment

by:Bang-O-Matic
ID: 34207199
AGX I Re-installed railo and it worked fine...

off the subject but have you ever tried to connect to a secure FTP server with railo? when I try to connect it says "Attribute secure is not allowed for tag cfftp" that was one of the main reasons I switched from CF7 to railo I thought it was CF8 compliant...obiviously not.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34207351
No. I don't think it's supported, but there are other options.
http://groups.google.com/group/railo/browse_thread/thread/1a891d87e8f71a01?fwc=1

You could also ask on the railo group.  

Btw: there was a cfftp bug in CF9 I think (and possibly CF8). So watch out for that.
0
 

Author Comment

by:Bang-O-Matic
ID: 34207559
Thanks for your help!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34207662
Welcome :)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Coldfusion print HTML tables 4 48
cfchart display 12 91
multi page pdf 4 69
Coldfusion remove square brackets from string 4 66
This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now