Closed mantielero closed 3 years ago
Asset manager is used to retrieve assets from the app resources, which are different things depending on your platform (on windows and linux this is res
folder). To load an image from an arbitrary file path use imageWithContentsOfFile
. To load image from arbitrary URL (including http://
, https://
, file://
) use loadImageFromURL
Thanks a lot. I managed to use imageWithContentsOfFile
. I don't know why loadImageFromURL
is not working for me. I am using similar code to your sample 3. Something like the following:
method init*(v: ImageSampleView, r: Rect) =
procCall v.View.init(r)
loadImageFromURL("file:///home/jose/src/pdf/Frances_01.pdf_FOLDER/original_thumbnails_256/68db24e7-fe4f-407b-89af-04bbbc7746f9-16.png") do(i: Image):
v.httpImage = i
v.setNeedsDisplay()
#do(i: Image, err: string):
v.image = imageWithContentsOfFile("/home/jose/src/pdf/Frances_01.pdf_FOLDER/original_thumbnails_256/68db24e7-fe4f-407b-89af-04bbbc7746f9-16.png")
v.setNeedsDisplay()
but b.httpImage
is empty, and I don't know why.
Ah, turns out loadImageFromURL
doesn't support file:
scheme. PRs are welcome :)
EDIT: loadImageFromURL
The question is answered i suppose
Yes it is. Thanks a lot mate.
Could you explain how the asset manager work?
I am trying to show an image using the full path, but I am failing (unless I put the image in the
res
folder).Regard Jose M.