I have some images names in a database. For example:
ImageA_1.jog
ImageA_2.jog
ImageB_1.jog
etc
Now what I want to know is there any way of adding a wild card in the image src so it can pull the images for all of ImageA etc (ignoring the _1 & _2 ???
I see what you are saying but how would i put that on for example:
product-images/{{barcode}}.jpg
Currently I have to use product-images/{{barcode}}_1.jpg to get it to work but obviously there are _2, _3 images as well which I want to show in a slider.
I have tried product-images/{{barcode}}% and this does not to work.jpg
I often have this sitation, and need to use the part excluding the ā_1.jpgā etc. as a foreign key - as you do, if I understand correctly.
I add an extra, virtual/generated column in the table, which extracts the part before the delimiter (ie ignores the _1.jpg etc in your example). This is an example expression: if(locate('-',img_filename),substr(img_filename,1,(locate('-',img_filename) - 1)),substr(img_filename,1,(locate('.',img_filename) - 1)))
(The delimiter in this case is a hyphen)
So the two columns will be:
If you are using MySQL, you will need to be using 5.7 (otherwise you could use a trigger). I donāt know about other databases.
I imagine this method wonāt be required when we can create custom queries. However, there might be advantages in this approach in any case.
Why not use the query builder filters option? Use ācontainsā or āstarts withā as a condition and the query will return only the records which start with āimageAā - then on your repeat region it will only display these images.
OK so update on how I need to do it after going through the database. When we pull the data out of the system it does not reference the barcode.
So what I somehow need to do (I want to do it with the image slider) if somehow pull files from ā¦/product-images/
in the data base it will have the barcode eg. abc123
How would i pull the files for abc123_1, abc_2, etc
so I can get all the image in the slider.
The wildcard has to be used in the server action then server connect query will return all the matching records. You can use that record set directly as the image source for the swiper
the images are the name of the barcode so example abc123.
When the images get uploaded through another program then upload as abc123_1, abc 123_2 etc
_1 being the default image.
no they are not in the database under abc123_1, abc123_2
(if they were it would be easy)
In the database it is stored as abc123
Basically what I need to do is get some way of filtering the /product-images. folder with anything that contains abc123
The images are saved as the barcode name which is allocated when the product is put in through a different program (basically Iāve exported the data to populate the webstore). Everything is working apart from getting multiple images
So you donāt have the filenames in the database and donāt know the exact number of images. They are all locatec in a folder on the server and the filename is the barcode plus some suffix.
Then use the list folder action to get all the files in the images folder and use the filter/where formatter to filter them.
Thanks Patrick, Iāve slowly worked that out this morning and have managed to get to work on a single barcode, just got to replace that with a dynamic one (which hopefully will be easy)
But happy days I have a working test