Solved

cfimage resize

Posted on 2010-11-20
11
451 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

948 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

16 Experts available now in Live!

Get 1:1 Help Now