SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: CFImage problem

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CFImage problem

    I am building a photo gallery that I don't want to plug into a DB for quick re-usability. When a user uploads an image it uploads the image into a folder called photos and every user has there own folder titled #firstname#_#lastname# in that folder. The directory query keeps the folder name in a variable called directory and the file name in a variable called name. So I have cfscript that will pull the folder name and then the file name and push them together.

    Code:
    <cfdirectory action="list" directory="#localphotopath#" name="PhotoDirectory" listinfo="all" recurse="yes" type="file">
    <cfdump var="#PhotoDirectory#" expand="no">
    
    <table cellpadding="3" cellspacing="3" border="0">
    	<thead>
    		<tr>
    		 <th colspan="4">Full Photo Gallery</th>
    		</tr>
    		<tr>
    			<td colspan="4" align="left"><a href="/choosegallery.cfm">View Photo's By Name</a></td>
    		</tr>
    	</thead>
    	<tbody>
    		<cfset col = 0>
    		<cfoutput query="photodirectory">
    			<cfscript>
    				file = photodirectory.name;
    				filefolder = listGetAt(directory,5,"\");
    			</cfscript>
    					<!---fullpath = filefolder & "/" & file;--->
    				<cfdump var="#filefolder#"><br>
    				<cfdump var="#file#">
    		
    			
    		</cfoutput>
    	</tbody>
    </table>
    The problem is that when I dump the file variable it returns an empty structure, but when I dump the full cfdirectory variable it shows file names in the name column.

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    FILE is a reserved CF word.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cfStarlight View Post
    FILE is a reserved CF word.
    Sorry I was copying this post over from DIC because nobody answered it, and I didn't look at the body of it before I copied it and therefore copied the wrong post... I fixed that problem a long time ago.

    So the problem that I have now is that I am actually in a user's folder trying to output thumbnails of the photo's into a table that will have 4 image's per row (I have not built the rows yet, but they will be dynamically built.). So I am trying to dynamically resize the images to thumbnail size, but get an error that I put below. When I just show the image in a regular HTML image tag it shows the fullsize image.

    Code:
    <cfset localphotodir = localphotopath & url.folder>
    <!---<cfdump var="#localphotodir#">--->
    <cfdirectory action="list" directory="#localphotodir#" name="PhotoDirectory" listinfo="all" type="file" recurse="no">
    <cfinclude template="/common/incl_nav.cfm">
    <cfdump var="#PhotoDirectory#" expand="no">
    
    <table cellpadding="3" cellspacing="3" border="0" align="center">
    	<thead>
      	<tr>
        	<th colspan="4"><cfoutput>#listFirst(url.folder,"_")#'s Photos</cfoutput></th>
        </tr>
      </thead>
      <tbody>
        <tr>
    			<cfset col = 0>
    			<cfoutput query="PhotoDirectory">
     				<cfscript>
    					IMGPath = photopath & listFirst(url.folder,"\") & "/" & photodirectory.name;
    					Thumb = ImageNew(IMGPath);
    					ImageResize(Thumb,"100","");
    				</cfscript>
            <td>
    					<cfimage source="#thumb#" action="writetobrowser">
            </td>
          </cfoutput>
    An exception occured while performing the writetobrowser cfimage action.

    coldfusion.image.Image$ReadImageMetadataException: Exception occured in JPG processing. segment size would extend beyond file stream length

  4. #4
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Either it is a bad image or a bug with the cfimage tag (though probably fixed in one of the patches). Check your update levels and make sure you have the latest:

    http://kb2.adobe.com/cps/402/kb402604.html

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cfStarlight View Post
    Either it is a bad image or a bug with the cfimage tag (though probably fixed in one of the patches). Check your update levels and make sure you have the latest:

    http://kb2.adobe.com/cps/402/kb402604.html

    I have the newest version of ColdFusion. I think the problem is with the ImageResize function, because I built a similar cfscript function on another page that uses gif images and works fine, but this is all jpeg images, so I think that ImageResize() can't do the jpeg images for some reason.

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I looked more stuff up about my problem, and learned that is it a ColdFusion bug with cfimage. The only way that I could fix it apparently is to revert my Server back to CF 8.0.0 which I would really prefer not to do. Any other options that anyone can think of?

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ColdFusion had a HotFix on the site for the problem. It took me awhile to find it because it wasn't on the page you posted a link for, but I Updated my Dev machine with it and am going to update my main webserver with it tonight.

  8. #8
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post the link for it, to help future readers.

  9. #9
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  10. #10
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good to know. But that is already included in the previous link. You must have missed it.

  11. #11
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Wallingford, CT
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I must have missed it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •