• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

cfimage resize

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
Bang-O-Matic
Asked:
Bang-O-Matic
  • 7
  • 4
1 Solution
 
_agx_Commented:
Stupid question, but .. is that the exact code you're running? Because the snippet works perfectly for me.  
0
 
Bang-O-MaticAuthor Commented:
Yes it is.  I'm thinking it must be an issue with Railo?
0
 
_agx_Commented:
Must be. Though it looks right and runs fine for me with Railo 3.1.2.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
_agx_Commented:
Slight correction. The cfdirectory is missing an explicit action="list". So you may as add it.  Can't hurt.
0
 
Bang-O-MaticAuthor Commented:
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
 
_agx_Commented:
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
 
_agx_Commented:
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
 
Bang-O-MaticAuthor Commented:
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
 
_agx_Commented:
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
 
Bang-O-MaticAuthor Commented:
Thanks for your help!
0
 
_agx_Commented:
Welcome :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now