I am looking for a way to load an image from my disk into a CPImageView. Is this possible?
Asked
Active
Viewed 383 times
0
-
1You mean you want to upload an image to a Cappuccino app and have it display? Cappuccino can't receive your upload, you'd have to send it to your server and then you'd display it like you display any image on your server in Cappuccino. – Alexander Ljungberg Feb 02 '12 at 23:07
1 Answers
1
To upload an image to a server, you could either use a normal file upload button such as what is implemented by FileUpload
. Or, if you're not afraid of some potentially very tricky cross browser problems you could try to use my fork of Deep Drop Upload
which allows drag and drop upload.
In either case, once the image is on your server you need your server to return the URL of where the image can be viewed. Let's say this URL is http://example.com/uploads/image101.png
. Then you can display it in a CPImageView
the normal way:
var imageView = [[CPImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[imageView setImage:[[CPImage alloc] initWithContentsOfFile:"http://example.com/uploads/image101.png"]];

Alexander Ljungberg
- 6,302
- 4
- 31
- 37