Solved

cfimage resize

Posted on 2010-11-20
11
457 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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
 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cold Fusion Not Recognizing .NET DLL Updates 7 54
Sending Text Messages 1 56
query of query sort 6 100
InputBaseN() returns different value in ColdFusion 10 and CF2016 5 98
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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