I've got 2 directories on my root:
/images/ <-- with user's images /media/ <-- with system ( and components ) images The global parameter for image root is set to media but I want to decide via the field where to find my image.
The XML for the admin form is
<field id="contest_image" name="contest_image" type="NewMedia" required="false" imgroot="images" directory="" label="Contest_image" description="contest_image_Desc" preview="true" exclude="" stripext="0" /> I've duplicated the original field in NewMedia for avoiding confusion and set this one with:
if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $folder = $this->imgroot . '/'.$this->directory; } elseif (file_exists(JPATH_ROOT . '/' . $this->imgroot . '/' . $this->directory)) { $folder = $this->imgroot . '/'.$this->directory; } else { //$folder = ''; $folder = $this->imgroot ; } Can anyone help me ?