-
1. Re: BLOB Images in and out of Oracle
Owain North Mar 30, 2012 5:48 PM (in response to Glowball)Definitely use cfqueryparams in your update statement, solves so many issues with datatypes.
-
2. Re: BLOB Images in and out of Oracle
Glowball Mar 30, 2012 5:52 PM (in response to Owain North)I edited the code for clarity, it actually looks quite different than that. I cut out all of the excess so it would be easier to focus on what I was trying to do.
-
3. Re: BLOB Images in and out of Oracle
-==cfSearching==- Mar 30, 2012 9:22 PM (in response to Glowball)1 person found this helpfulIt seems that if I start with an actual file in step 1 it works, but not if it's binary to start.
Looks like that is a known issue. There is an undocumented work-around suggested in the comments here
ie Using imageObject.getImageBytes("jpg")
Though you should definitely use cfqueryparam in the actual query.
-
4. Re: BLOB Images in and out of Oracle
Glowball Mar 30, 2012 11:32 PM (in response to -==cfSearching==-)Thanks, cfSearching, that was a helpful link. It's always good to see I'm not the only one running into an issue. FYI, I've been a CF developer for eleven years and I wouldn't dare to use a query like I posted. But I wanted to get everyone's opinion on the image issue instead of having people focus on the mechanics of putting data into a database. I'm using cfqueryparam along with a ColdBox framework and it all works well, but it's not relative to this particular discussion. I wanted to simplify things by showing what I was doing in the most basic manner.
-
5. Re: BLOB Images in and out of Oracle
-==cfSearching==- Mar 31, 2012 11:53 AM (in response to Glowball).. I wanted to simplify things by showing what I was doing in the most basic manner.
Yep, that makes complete sense. I always mention cfqueryparam when I do not know the background of the person asking the question. Feel free to note it was omitted for clarity next time, to stave off future "helpful" hints ;-)
-Leigh
-
6. Re: BLOB Images in and out of Oracle
BKBK Mar 31, 2012 12:07 PM (in response to Glowball)Glowball wrote:
It could be that imageNew() expects an image as parameter, and not on a binary. What happens when you first convert from binary to image, like this?
<cfset imageAsBase64String = binaryEncode(get.file_binary, "base64")>
<cfset thisImage = imageReadBase64(imageAsBase64String)>
<cfset ImageResize(thisImage, "500", "", "mediumQuality")>
...
etc.
-
7. Re: BLOB Images in and out of Oracle
-==cfSearching==- Mar 31, 2012 12:19 PM (in response to BKBK)It could be that imageNew() expects an image as parameter, and not on a binary.
Actually it accepts several parameters, including "A BLOB from a database that contains image data."
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-79 6f.html
-
8. Re: BLOB Images in and out of Oracle
BKBK Mar 31, 2012 12:43 PM (in response to BKBK)BKBK wrote:
Please read "and not a binary".
-
9. Re: BLOB Images in and out of Oracle
Glowball Mar 31, 2012 2:07 PM (in response to BKBK)I'll try that the next time I'm working on it, thanks!
-
10. Re: BLOB Images in and out of Oracle
-==cfSearching==- Mar 31, 2012 2:38 PM (in response to Glowball)1 person found this helpfulI just tried it and no change. Creating the image does not seem to be the problem. But rather how CF determines the image format when returning the bytes. From what I observed, it mistakenly uses file extension to determine the image type. Obviously that does not apply if the image was created from a byte array or bufferedImage. Sounds like a bug.
-Leigh
Message was edited by: -==cfSearching==-
-
11. Re: BLOB Images in and out of Oracle
Glowball Mar 31, 2012 2:47 PM (in response to -==cfSearching==-)Hey, thanks for checking that out for me, I appreciate it. It's always good to hear when someone else is seeing the same weirdness.
-
12. Re: BLOB Images in and out of Oracle
-==cfSearching==- Mar 31, 2012 3:01 PM (in response to Glowball)It's always good to hear when someone else is seeing the same weirdness.
No problem. A second (or third) set of eyes makes a great sanity check.
Message was edited by: -==cfSearching==-