Skip to main content
XeeMe
Participating Frequently
July 20, 2012
Question

Image Error

  • July 20, 2012
  • 1 reply
  • 1614 views

All of a sudden we get this error message:

The code worked for several months










javax.imageio.IIOException: Can't get input stream from URL!




WE now added a CFTRY just to keep the page working

<cfif XeePV GT 9999>

     <cfset leftaln = 22>

<cfelseif XeePV GT 999>

     <cfset leftaln = 36>

<cfelseif XeePV GT 99>

     <cfset leftaln = 43>

<cfelseif XeePV GT 9>

     <cfset leftaln = 48>

<cfelse>

     <cfset leftaln = 51>

</cfif>

<!--- Create the XeeScore Button on the fly --->

<cftry>

<cfset myImg = ImageNew("http://xeeme.com/_/assets/images/XeePV-Button.png")>

<cfset attr=StructNew()>

<cfset attr.font="Arial">
<cfset attr.size = "50">

<cfset attr.style = "bold">

<cfset ImageDrawText(myImg, "#NumberFormat(XeePV, "_,___")#", #leftaln# ,100,attr) />

<center>

<a class="helpbox" href="##ddXeePV" border="0"><cfimage action="writeToBrowser" source="#myImg#" border="0"></a>

<cfimage source="#myImg#" action="write" destination="#APPLICATION.BaseDir#\_\Data\XeeScore\#session.auth.usr_ID#.png" overwrite="yes">

</center>

<cfcatch></cfcatch>

</cftry>

I just can't figure out what the issue is.
The image is there and always have been:
http://xeeme.com/_/assets/images/XeePV-Button.png
http://xeeme.com/_/assets/images/XeePV-Button.png

Thanks for any tip

Rob

This topic has been closed for replies.

1 reply

itisdesign
Inspiring
July 21, 2012

Hi XeeMee,

The code below works fine for me (no error, and image is displayed in browser and saved to disk) on CF9.0.1 and CF10:

-----------

<cfset XeePV = 8>

<cfif XeePV GT 9999>

  <cfset leftaln = 22>

  <cfelseif XeePV GT 999>

  <cfset leftaln = 36>

  <cfelseif XeePV GT 99>

  <cfset leftaln = 43>

  <cfelseif XeePV GT 9>

  <cfset leftaln = 48>

  <cfelse>

  <cfset leftaln = 51>

</cfif>

<!--- Create the XeeScore Button on the fly --->

<cfset myImg = ImageNew("http://xeeme.com/_/assets/images/XeePV-Button.png") />

<cfset attr=StructNew()>

<cfset attr.font="Arial">

<cfset attr.size = "50">

<cfset attr.style = "bold">

<cfset ImageDrawText(myImg, "#NumberFormat(XeePV, "_,___")#", #leftaln# ,100,attr) />

<center>

  <a class="helpbox" href="#ddXeePV" border="0">

  <cfimage action="writeToBrowser" source="#myImg#" border="0">

  </a>

  <cfimage source="#myImg#" action="write" destination="#expandPath('./foo.png')#" overwrite="yes">

</center>

-----------

Couple notes:

1) Extra # signs can optionally be removed from ImageDrawText(myImg, "#NumberFormat(XeePV, "_,___")#", #leftaln# ,100,attr) and simply become: ImageDrawText(myImg, NumberFormat(XeePV, "_,___"), leftaln ,100,attr)

2) Creation of the attr struct can optionally be shortened to: <cfset attr = {font="Arial", size=50, style="bold"} />

Thanks,

-Aaron

XeeMe
XeeMeAuthor
Participating Frequently
July 21, 2012

Thanks for the notes Aaron. It works well on my local machine - also on our stage server - not on the production server. All are identical CF9.01 Win 2008... I start to believe there is some weakness inside the CFIMAGE Code - there are many similar complaints in the web with no definitive solution. I guess I need to consider it one of those bugs