Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Image Error

New Here ,
Jul 20, 2012 Jul 20, 2012

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

1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 20, 2012 Jul 20, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 21, 2012 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 21, 2012 Jul 21, 2012

Some more update on this:

This works

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

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

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

                                                                                                                                  <IMG SRC="#APPLICATION.BaseSITE#_/Data/XeeScore/#session.auth.usr_ID#.png" border="0">

</a>

If I use CFIMAGE instead of <IMG SRC...> it throws an error

#myimg# is obviously defined and the image is created so it can be read with IMG SRC
But using the simple CFIMAGE writeToBrowser it sais it cant read the image.

Too weired

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 22, 2012 Jul 22, 2012

Hi Rob,

Could you try this, and let me know the output when it throws an error?

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

<cftry>

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

  <cfcatch>

    <cfoutput>#isImage(myImg)#</cfoutput>

    <cfdump var="#myImg#" />

  </cfcatch>

</cftry>

Thanks,

-Aaron

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 23, 2012 Jul 23, 2012
LATEST

Hi Aaron -

yes, it does throw an error. I extended the test with this code:

<cftry>

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

          <cfcatch>

          <cfoutput>

          An error happend trying to grab this image:

          <IMG src="http://xeeme.com/_/assets/images/XeePV-Button.png"><BR>

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

          </cfoutput>

</cfcatch>

</cftry>

<cftry>

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

  <cfcatch>

  <cfoutput>#isImage(myImg)#</cfoutput>

  <cfdump var="#myImg#" />

  </cfcatch>

</cftry>

ERROR: You can see the result on our production server: http://xeeme.com/test/test.cfm   Note:CF 9.0.1

Server ProductColdFusion
Version9,0,1,274733 
EditionStandard 
Operating SystemWindows Server 2008 R2 
OS Version6.1 
Adobe Driver Version4.0 (Build 0005) 
JVM Details
Java Version1.6.0_17 


WORKS FINE: The exact same code on stage: http://stage.xeeme.com/test/test.cfm   Note:CF 9.0.0

Server ProductColdFusion
Version9,0,0,251028 
EditionStandard 
Operating SystemWindows Server 2008 R2 
OS Version6.1 
Adobe Driver Version4.0 (Build 0005) 
JVM Details
Java Version1.6.0_17 

WORKS FINE: local machine again CF 9.0.1

Server ProductColdFusion
Version9,0,1,274733 
EditionStandard 
Operating SystemWindows 7 
OS Version6.1 
Adobe Driver Version4.0 (Build 0005) 
JVM Details
Java Version1.6.0_17 

Thanks so much for helping here

Rob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources