Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

cfimage resize

Posted on 2010-11-20
11
Medium Priority
?
471 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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

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.

Question has a verified solution.

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

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…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

610 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