• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Image Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image Problems


  • Subject: Re: Image Problems
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Tue, 12 Jul 2005 09:21:07 +0200

A newbie answering here, so don't take it as 100 percent. Just saw that the post were standing there unanswered for a few days...

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

Looks OK as far as I can see. A dynamically generated URL for temporary data in a WO app.



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
Strange...
Content-Type: text/plain

Should this not be text/HTML in the case of a component rendering? Or if you are using the page to display image data as content, should it not be set to the appropriate mime type of the image?



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.

I am not sure about output streams there... Does an output stream get empty once you write from it or invoke toByteArray() ??? If you are not sure as well, log out the data length just before returning. Or have a byte[] (or NSData) variable that caches the data from the output stream and passes it both to the file and to the return statement.


If you do that and still have the problem, then it might be your component and it's bindings, or whatever other construction you use for displaying that thumbnail. In which case it would be good if you elaborated on that a bit more.


Any help is really appreciated.

Regards,
Greg

Cheers F

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
References: 
 >Image Problems (From: Greg <email@hidden>)

  • Prev by Date: Re: Compound Primary Keys and WO
  • Next by Date: Re: form post
  • Previous by thread: Image Problems
  • Next by thread: Bindings with 'this'
  • Index(es):
    • Date
    • Thread