I encountered the same issue, and no matter which method I use, I still can’t import the images correctly.
@ankrotachi10. Perhaps you should separate it out into two statements like I did. Try this:
$tu(rndimg,0.167, “/Kustom/lckwp/”)$
$if(gv(work)=1, “/Kustom/lckwp/89311586_p0.png”)$
I’m still new to this so you may have to play around with the above code. I recall attempting to use an all inclusive statement and couldn’t get it to work until I separated it out into 2 statements. Here’s a screenshot of the code I’m using for my desktop:
Hi there,
In regards to the issue on getting an image from a folder, I would like to suggest these solutions.
Get a random image
Use a Flow to get the path to a random image, then store it into a global variable. Then point the path of the Image element to that global variable.
This method works both in the editor and on homescreen.
Get an asset image (i.e. a weather icon)
Add a global variable of Image and pick an image to store its path. Then use that global variable whenever needed.
I hope this would help.
the “photos and videos” permission in the phone settings does not appear.
Can you confirm if you were having the general issue of images not showing? I tried formatting my path the same way but still cannot get them to show, is the flow critical in some way ie the formatting of the path with % in ?
The shortened link directly to the Kustom folder worked on my end.
Hi there,
I don’t have the issue with getting the image using a Flow.
Previously I used the $tu(rndimg)$ function, but later when it didn’t work and I found the reference mentioning to use the Flow to get the image, I have been using it since then.
The % in the filepath is automatically used by the File Picker action of Flow. I didn’t add the % manually.
I hope this would help.
Hey everyone!
For those who tried the solution but still can’t display images properly, I’ve finally found a fix.
Today, I experimentally moved Kustom’s main working floder to my phone’s root directory, just like the Kustom folder shown in the image, and suddenly the images started displaying correctly!
This issue that had been bothering me for a long time is finally resolved. I hope this helps you all.
Hi,
Sorry to say my folder was already in root
I tried making a new copy of the folder and repointing it there, klwp kindly emptied the folder so I copied data in and images still won’t load at all from there
Hi again, just to confirm I attempted the timed random image which DOES fill in a path in editor to a valid image… But doesn’t display still.
I tried to point it to another folder and that won’t work at all, no file path shown so looks like that is the permissions issue mentioned previously.
Sorry to say I think that along with static images working it shows the permissions aren’t the issue preventing images showing
Let me try to recap the “storage” situation. Kustom due to recent Google policies does not have direct storage access anymore, any access to storage is done through “scoped storage”. So specifically for the use case above there are currently 2 ways of getting images:
- Preferred solution is using flows, you can use flows in any folder and it can pick images randomly, you can see an example here: Get a random image on click | Kustom HQ
- The “old” way via $tu(rndimg, 1, “path”)$ will work ONLY IF images are inside Kustom managed folder, path starts with “/Kustom” and the app has access to that directory, so, for example
- Kustom has access to your “sdcard” (emulated or not), in folder “Kustom”
- You create a folder called “images” inside and put some stuff into it
- You use the formula
$tu(rndimg, 1, "/Kustom/images")$
(Kustom will then replace /Kustom with the right path internally using again scoper storage)
Hi @frank ,
I would suggest you to update the brief description of the related function in each application (KLWP, KWGT, KLCK, and KWCH), like $tu(rndimg, 1, “path”)$
and also its example, so that no user get confused. Currently, there’s no mention about using the /Kustom/images
in the application.
This is just my suggestion, what do you think?
For those still struggling with making the image actually appear (whether or not a filename appears in the image item), try this:
- Go to General Settings | Main Storage and reset Kustom as your main storage folder
- Return to the image item (or the global variable you’re using to feed several image items), delete the formula contents, and rebuild it using the sample tu formula [e.g. $tu(rndimg, 15, “/Kustom/images”)$ ]
The image should now render. Anyway, redoing the formula from scratch was crucial to making it work for me!
Kustom does cache stuff so it might take a while to appear, please use flows where possible as they provide much more flexibility here
Thanks, noted, i will try to also catch the /emulated/…/ path in the next version, actually in general i will try to make matching with folders Kustom has access to a bit more creative, will do in 3.78
Hey Frank,
Thank you so much I now finally have a working solution
So what worked was to follow your flow guide and give access to the folder. The flow works but took 57 secs to pick one (from a folder of about 1800) so I then checked the file path syntax used in the variable it sets ie the full content:// and replicated that in my tasker file selector and it works!!!
After all that I tried a few methods to see if the permissions would fix it for the other ways to reference the images including using:
- /Kustom …
- /storage/emulated/0/kustom…
- tu(rndimg…
I did that with the direct reference and file:// and nope still wont show them at all
I was hoping that granting permissions would make the other path syntax work also but a global containing the long content path is the only working method …for me at least
oh @usertim thanks, I tried that but no joy
For anyone still having issues you may need to setup the flow to allow the permissions dialogue to show first.
Here is my file path for the “/Kustom/Walls” folder, note that the %image on the end is the name of my tasker variable holding the image filename so replace as needed, the rest should go in exactly as is…
content://com.android.externalstorage.documents/tree/primary%3AKustom%2FWalls/document/primary%3AKustom%2FWalls%2F%image
Hope that helps someone
What would you suggest for fetching non-random images? Specifically, the behavior I want is to switch images depending on the time of day. Is there a way I can implement that conditional into a static image?
Hi there,
You can add several global variables of Image type, to store the images you want to use.
Then, point to that global variables according to the condition you set.
I hope this would help.
Hi!
Same here. No solution worked. Any fix on the road?
Thanks.