Static Image Location
Permalink
Hi Guys,
I've got a HTML theme that loads a random background image every time you load a page. These images are loaded from a designated folder of images. Let's say it's 'theme/bg-images'.
I can change the path of the folder where the images are to be located. However all the images need to reside in that folder.
My question is: Is it possible to have my client load and manage the images in via concrete and still retain all the images in a single folder?
I've got a HTML theme that loads a random background image every time you load a page. These images are loaded from a designated folder of images. Let's say it's 'theme/bg-images'.
I can change the path of the folder where the images are to be located. However all the images need to reside in that folder.
My question is: Is it possible to have my client load and manage the images in via concrete and still retain all the images in a single folder?
Rather than doing it in a folder within your structure you could have them manage images within a fileset. Then in your script you would just get all the files from that fileset and randomly show one. Here is some sample code
Hi hutman,
Thanks very much for your reply.
Is this code suitable for 5.7? I can't find most of these methods in the API. Although i do understand the general gist of your code.
Would you know the equivalent 5.7 methods?
Thanks very much for your reply.
Is this code suitable for 5.7? I can't find most of these methods in the API. Although i do understand the general gist of your code.
Would you know the equivalent 5.7 methods?
Actually apologies hutman - your code was spot on.
It didn't like this though:
$fileList->filterByType(FileType::T_IMAGE);
gets me:
Class 'FileType' not found
It would be great if i could filter by image type 'jpg'.
It didn't like this though:
$fileList->filterByType(FileType::T_IMAGE);
gets me:
Class 'FileType' not found
It would be great if i could filter by image type 'jpg'.
Sorry about that, as you said there are no 5.7 docs to speak of so it's really hard to tell what will/won't work other than just guess and check. All that line does is make sure it only grabs images, but as long as you train your client to only put images in that set you should be fine.
Thanks hutman, you've been a great help :)