upload several images in form to unique directory

DickTracy

New Member
Hi

I have a form where users can upload several photos and I need these photos to go in their own directory eg images/stories/review/111/ where 111 is a unique directory

I can't use {$my->id} because the same user might submit the form several times for different items, and I can't use $Itemid because until the form is submitted there is no $Itemid (as far as I can tell)

Is there any way to incorporate a unique reference in the 'image upload directory' that would make this work?

Thanks for any help
 
What about setting "Obfuscate Filename" or using {$my->id} as directory and setting "If existing image found?"="increment new file's name"?
 
The problem is the photos need to be in a separate directory because I then use a joomla photo gallery plugin which uses the command {gallery}directoryname{/gallery} to identify the photos for the gallery - it creates a photo gallery from all images in that directory, so having different filenames in the same directory won't work

(The site is for holiday rental properties, where one owner might have several different properties to add).
 
How do you tell Joomla photo gallery where to look for the images, do you have to do this manually? I'm interested because of an article I'm writing intergrating joomgallery with fabrik.


Back to your question though, you can use placeholder for any of your elements.


So if you have a list called properties with the following elements


description
client
propertyname
image_uploads

You can then do:-


/images/{properties___description}

Which means the directory name would be called whatever you put in the description.


Better still would be /images/{properties___client}/{properties___description}


To keep you images in order, or.


Better still would be /images/{$my->id}/{properties___description}
 
Excellent answer, thanks. after a bit of experimenting I think {tablename___id} with id being the auto incremented id should do the trick.

I'm not familiar with joomgallery, I'm using the sigplus image gallery plugin, so not sure it works on the same principle - for sigplus you specify a 'base directory' in the parameters (typically images/stories) then on each article you can use:
{gallery}name_of_subdirectory{/gallery} to create the gallery automatically.

So using something like sourceror (which allows php code to be added into an article) I can now use:

{gallery}{source}<?php echo '[insert code to find correct directory for property in table created via fabrik]'; ?>{/source}{/gallery}

works a treat now I can define the images directory at upload time.
 
Great glad that's a working solution for you.

With the sigplus I agree that's the way I would do it as well, but you can use the display element as well instead of sourcerer or put the code directly into a custom template.

It makes no difference though as they are all working solutions. :)

Thanks for posting back.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top