The Coldfusion Open Source Forums
Home | ImageCFC | CFFM | BlogCFM | CFMBB | CFOpenMail / ImapCFC | CFOpenChat
Forums | Profile | Inbox | Members | Chat | Search | Login | RSS
Vivio Technologies CFML Hosting
New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page

Forums: ImageCFC Forum: addText bug?
Created on: 05/25/07 {ts '2018-12-15 20:55:00'} Views: 18967 Replies: 8
addText bug?
Posted Friday, May 25, 2007 at {ts '2018-12-15 20:55:00'}

I've been using imageCFC for a little while now and just discovered a problem with the addText function. When called, the function creates a temporary file like "/tmp/+~JF36628.tmp" (on Linux) but it does not clean up when it is finished. So if you don't manually delete the files in the /tmp/ directory you'll eventually run out of space.

I found this out with a site that I'm working on that creates images with 30-50 captions (addText). So for each image that was created, 30-50 temporary files were created. It took about a day to run out of space on my dev server.

Any suggestions?

RE: addText bug?
Posted Friday, May 25, 2007 at {ts '2018-12-15 22:02:00'}

It's not actually a bug, it's something that java does, and I find it to be rather obnoxious.

I guess I never mentioned it, but I use imageCFC for captcha generation and I had the same problem.

MY solution was a cron job that looks like this:


* * * * * /usr/bin/find /tmp -cmin +2 -name \*JF\*.tmp | /usr/bin/xargs /bin/rm

This deletes all of those tmp files more than 2 minutes old.

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: addText bug?
Posted Tuesday, May 29, 2007 at {ts '2018-12-15 13:14:00'}

bummer. That's what I was doing, but it seems there must be a better way. It would be self destructive for Java to have such annoying features.

I'll keep looking and post back if I find anything.

RE: addText bug?
Posted Tuesday, May 29, 2007 at {ts '2018-12-15 20:13:00'}

Update: For those who care, I did find a semi-solution to this problem.

The createFont method of java.awt.Font takes an InputStream (java.io.FileInputStream) as the file with the font attributes (ttf file). The method creates a temporary file as a connection to the FileInputStream but does not release it, even if you call the close method.

To work around this I use the generic fonts instead of loading the ttf font file. So Instead of this in the addText function:

font_stream.init(fontDetails.fontFile);
font = font.createFont(font.TRUETYPE_FONT, font_stream);
font = font.deriveFont(javacast("float",fontDetails.size));

I use:
font.init('serif',evaluate(fontDetails.style),fontDetails.size);
- or -
font.init('sansserif',evaluate(fontDetails.style),fontDetails.size);
- or -
font.init('monospaced',evaluate(fontDetails.style),fontDetails.size);

This is "supposed" to also work with any installed system font on the server but I have not been able to get it to do so. For my purpose, sansserif works fine.

I also played with using cffile to readbinary the ttf file and passing that variable to a java.io.ByteArrayInputStream but it ends up the same. If any java gurus out there know a better solution please advise.

RE: addText bug?
Posted Thursday, May 31, 2007 at {ts '2018-12-15 11:40:00'}

BTW, ImageCFC now has this functionality built in as an option.

The FontDetails struct can now contain EITHER the fontFile key *OR* the fontName and style keys (I made an assumption based on the java docs that your "evaluate(fontDetails.style)" takes "font.PLAIN" "font.BOLD" or "font.ITALIC")

That's in ImageCFC 2.16

http://www.opensourcecf.com/imagecfc/download.cfm

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: addText bug?
Posted Wednesday, July 11, 2007 at {ts '2018-12-15 21:56:00'}

Sure, the platform is BlueDragon Server JX 6,2,1,302 running on a Linux server.

i'm not getting a "cannot connect to X11 server" and "This graphics environment can be used only in the software emulation mode", but i think the issue is related to the ClassNotFound exception. With regard of addText note, I have no access to /tmp folder since I'm just a web developer Crying or Very sad I followed the thread and modified my file, but I'm still getting the same error.

Thanks for your help again.

RE: addText bug?
Posted Wednesday, July 11, 2007 at {ts '2018-12-15 22:28:00'}

The /tmp folder is usually publically accessible.. however, I guess I'm confused. Did I send you to this thread?

This really only applies to people who successfully are able to add text to images.... From your other thread, I thought you weren't able to do anything.

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: addText bug?
Posted Thursday, July 12, 2007 at {ts '2018-12-15 15:05:00'}

oopsss wrong thread. sorry

RE: addText bug?
Posted Saturday, November 22, 2008 at {ts '2018-12-15 09:35:00'}

So is this bug fixed or not? I want to setup this functionality as a captcha script but also don't want to have to go clean up the extra files.

New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page
Subscription Options
Subscription options are available after you log in.

There are 26 active user sessions right now.