Need Help with -> object.fill with image located in subfolder of system.DocumentsDirectory

Hello

I would like to create a dynamic slide show in my app from images taken with the cam.

I already store the images in a subfolder of the system.DocumentsDirectory

however…filling a rectange with

       object.fill = { type=“image”, filename=“corona-logo.png” }

works fine as long as the image is in the root or a subfoder of the system. ResourceDirectory , but i can’t get it to work to take images from the system. DocumentsDirectory.

Already tried a lot of things like

 filename = system.pathForFile(  “slideshow01.jpg” , system. DocumentsDirectory )

 filename = system.pathForFile(  “slideshow01.jpg” , system. TemporaryDirectory )

 filename = system.pathForFile(  “/subfolder/slideshow01.jpg” , system. DocumentsDirectory )

no success at all !!!  :frowning:

any ideas how to fill an object with an image which is NOT located in the ResourceDirectory ???

Thx in advance

Andreas

Try:  system.pathForFile( “subfolder/slideshow01.jpg”, system.DocumentsDirectory )

tried it without success…Failed to find image …on the simulator

btw…i am running corona on a mac using version 2393

maybe it is only on the simulator??

can anyone try to simple get  an image from any other dir then the ResourceDirectory…no matter of subdir or not.

I would even be even happy to get it from the tempdir :wink:

this works fine:

          imgSlideShow.fill = { type=“image”, filename= “slideshow01.jpg”}  

this is not working but i would be happy with it:

         imgSlideShow.fill = { type=“image”, filename=system.pathForFile( “slideshow01.jpg”, system.TemporaryDirectory )}
           

this is what I would like to get to work:

         imgSlideShow.fill = { type=“image”, filename=system.pathForFile( “/subfolder/slideshow01.jpg”, system.DocumentsDirectory )}
          

            
    

Actually its:

local paint = {
    type = “image”,
    baseDir= system.DocumentsDirectory,
    filename = “tower2.jpg”
}

local rect = display.newRect( 200, 200, 300, 300 )
rect.fill = paint

That’s the sample code from the documentation page.

Hi Rob,

that works like a charm :wink:

Even with the subfolder in this way…

 local paint = {
                type = “image”,
                baseDir= system.DocumentsDirectory,
                filename = “subfolder/slideshow01.jpg”
            }          
     
            imgSlideShow.fill = paint

Thx a lot…wonder why I was not able to find that in the documentation page ?

 

    !!!  This is what I call a perfect support !!!

Regards

Andreas

Its documented here:  http://docs.coronalabs.com/api/type/BitmapPaint/index.html

But I had to click through a couple of things to get to this page.

Rob

Try:  system.pathForFile( “subfolder/slideshow01.jpg”, system.DocumentsDirectory )

tried it without success…Failed to find image …on the simulator

btw…i am running corona on a mac using version 2393

maybe it is only on the simulator??

can anyone try to simple get  an image from any other dir then the ResourceDirectory…no matter of subdir or not.

I would even be even happy to get it from the tempdir :wink:

this works fine:

          imgSlideShow.fill = { type=“image”, filename= “slideshow01.jpg”}  

this is not working but i would be happy with it:

         imgSlideShow.fill = { type=“image”, filename=system.pathForFile( “slideshow01.jpg”, system.TemporaryDirectory )}
           

this is what I would like to get to work:

         imgSlideShow.fill = { type=“image”, filename=system.pathForFile( “/subfolder/slideshow01.jpg”, system.DocumentsDirectory )}
          

            
    

Actually its:

local paint = {
    type = “image”,
    baseDir= system.DocumentsDirectory,
    filename = “tower2.jpg”
}

local rect = display.newRect( 200, 200, 300, 300 )
rect.fill = paint

That’s the sample code from the documentation page.

Hi Rob,

that works like a charm :wink:

Even with the subfolder in this way…

 local paint = {
                type = “image”,
                baseDir= system.DocumentsDirectory,
                filename = “subfolder/slideshow01.jpg”
            }          
     
            imgSlideShow.fill = paint

Thx a lot…wonder why I was not able to find that in the documentation page ?

 

    !!!  This is what I call a perfect support !!!

Regards

Andreas

Its documented here:  http://docs.coronalabs.com/api/type/BitmapPaint/index.html

But I had to click through a couple of things to get to this page.

Rob