[Typo3-dev] user dependant storage of image files

Michael H.E. Roth mher at mher.de
Sun Oct 17 18:03:53 CEST 2004


Thanks for answering, but that's not what I meant.

I wanted to change the uploadfolder for an Image-Field in the $TCA.
Now here is how I solved it:

Store the path in the User-Profile TSconfig:
plugin.extensionname.imagepath = this-users-path

  "imagefield" => Array (
   "exclude" => 1,
   "label" => "LLL:EXT:...",
   "config" => Array (
    "type" => "group",
    "internal_type" => "file",
    "allowed" => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
    "maxsize" => '1000',
    "uploadfolder" =>
'uploads/tx_.../'.$GLOBALS['BE_USER']->userTS['plugin.']['extensionname.']['imagepath'],
    "show_thumbs" => '1',
    "size" => "4",
    "maxitems" => "4",
    "minitems" => "0",
    "autoSizeMax" => 4,
   )
  ),

But to retrieve it I have to store the subpath in another field ... (which
is not accessible to the user)
  "imagepath" => Array (
   "exclude" => 1,
   "label" => "LLL:EXT:...",
   "config" => Array (
    "type" => "input",
    "size" => "25",
    "checkbox" => "",
    "eval" => "trim",
    "default" =>
$GLOBALS['BE_USER']->userTS['plugin.']['extensionname.']['imagepath'],
   )
  ),

Now, more elegant and flexible would it be if the subdir would be prepended
to the actual image-filename.
Is there a hook for doing something like that? And if so, where can I find
it? So far I don't have any experience with hooks (didn't need them yet).

Again thanks for all hints, tips and comments

Michael
--
Michael H.E. Roth


"Frank Benkart" <frank.benkart at web.de> schrieb im Newsbeitrag 
news:mailman.1.1097606088.15181.typo3-dev at lists.netfielders.de...
> @A) this possible, mount the user folder in their user profil
> @B) if you want to do that automatically creating a new user, you have to
> modify the user save event with the hook in tce_main
>
> "Michael H.E. Roth" <mher at mher.de> schrieb im Newsbeitrag
> news:mailman.1.1097560258.18984.typo3-dev at lists.netfielders.de...
>> Hi all,
>>
>> I have an extension which also allows the BE-Users to upload images. 
>> Since
>> the BE-Users work on distinct subsets of records of this extension
> (realised
>> by assigning them different sys-folders), I want/need to keep their files
>> also apart. My idea was to create a subfolder for each BE-User in the
>> extensions upload folder i.e. for user 'abc' the upload folder
>> 'uploads/tx_extension/abc' and for user 'defg' the upload folder
>> 'uploads/tx_extension/defg'.
>> Now my questions:
>> A) is this possible
>> and
>> B) if this is possible, how?
>>
>> Thanks in advance for all tips and hints.
>>
>> Michael
>>
>> --
>> Michael H.E. Roth
>>
>>
>
> 






More information about the TYPO3-dev mailing list