Image Problems
Image Problems
- Subject: Image Problems
- From: Greg <email@hidden>
- Date: Mon, 11 Jul 2005 10:54:43 +1000
I have a component that has basic image editing in it and it
generates the thumbnails data dynamically. For some reason, and I
don't know when it occured, it stopped returning the image to the
browser, however the method is called on the component. I telneted
the url for the image data and all it returns is this:
GET /cgi-bin/WebObjects/ShoeBox.woa/-50212/wr?
wodata=4055578611751528312 HTTP/1.1
Host:localhost
HTTP/1.1 200 Apple
Date: Mon, 11 Jul 2005 00:40:12 GMT
Server: Apache/1.3.33 (Darwin) PHP/4.3.11
connection: keep-alive
content-length: 0
Content-Type: text/plain
I decided to see if this was the case and then wrote the thumbnail to
the filesystem. It writes it correctly. I'm at a loss as the reason
for this occurring. Below is my method.
Any help is really appreciated.
Regards,
Greg
public NSData thumbnailData() {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
JPEGEncodeParam encodeParam = new JPEGEncodeParam();
encodeParam.setQuality(0.8f); // Resolution
encodeParam.setHorizontalSubsampling(0, 1);
encodeParam.setHorizontalSubsampling(1, 2);
encodeParam.setHorizontalSubsampling(2, 2);
encodeParam.setVerticalSubsampling(0, 1);
encodeParam.setVerticalSubsampling(1, 1);
encodeParam.setVerticalSubsampling(2, 1);
encodeParam.setRestartInterval(64);
ImageEncoder encoder = ImageCodec.createImageEncoder
("JPEG", out, encodeParam);
encoder.encode(buffer);
log.info("jpeg size: "+out.size());
FileOutputStream f = new FileOutputStream(new File("/tmp/
img.jpg"));
f.write(out.toByteArray());
f.close();
return new NSData(out.toByteArray());
} catch (Exception e) {
log.error(e);
}
return null;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden