2.5 MVC component - recommended location to store public images

146 views
Skip to first unread message

AJH

unread,
Aug 15, 2012, 1:04:40 AM8/15/12
to joomla-de...@googlegroups.com
Is there a recommended convention for a 2.5 MVC component when storing images uploaded from the administration section to make them publicly visible when the component's views are rendered in the front end?

e.g. for component "com_foo":
  1. site/media/com_foo/...
  2. site/components/com_foo/images/...
Thanks!

Adam Stephen Docherty

unread,
Aug 15, 2012, 1:50:22 AM8/15/12
to Joomla! General Development
I believe the media folder as that is what it is intended for. Is also
good for security as you are not disclosing filepaths.

On Aug 15, 2:04 am, AJH <aaron.hu...@gmail.com> wrote:
> Is there a recommended convention for a 2.5 MVC component when storing
> images uploaded from the administration section to make them publicly
> visible when the component's views are rendered in the front end?
>
> e.g. for component "com_foo":
>
>    1. site/media/com_foo/...
>    2. site/components/com_foo/images/...
>
> Thanks!

Saul Alejandro Martinez Castelo

unread,
Aug 15, 2012, 2:14:54 AM8/15/12
to joomla-de...@googlegroups.com
This tutorial has a great example on how to manage public assets and having them organized by extension in the media/ directory. I haven't tried myself, but I think it would be possible to declare where to store extension assets in the media section of the manifest:


<media destination="com_helloworld" folder="media">
	<filename>index.html</filename>
	<folder>images</folder>
</media>

http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Developing_a_Basic_Component

>
> Thanks!

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.




--
Saul Martínez

Ove

unread,
Aug 15, 2012, 6:14:18 AM8/15/12
to joomla-de...@googlegroups.com, Saul Alejandro Martinez Castelo
Hi,
as far as I know there is only one path to use for public images i.e. images/ For a component use images/mycomponent (or similar) and sub folders. Then you can handle uploads with com_media and use the images within the editors in e.g. articles. Some editors have settings for it but this would not be a general solution.

I have the "opposite" problem/question. Where to store images only public to my_component and not in general to the editors. Could be the media folder as it seams to be a basket for all. I've choosen to use the component folder per default and make it configurable. Nevertheless I have to code my own upload and image handler.

Regards
Ove

Ove

unread,
Aug 15, 2012, 8:21:58 AM8/15/12
to joomla-de...@googlegroups.com, Saul Alejandro Martinez Castelo
Hi Saul,

I think your answer was only to me and not to the thread so first a quote.

"
Hi Ove,
I agree with you regarding to where to store "public" images.
This doesn't seem like an issue that needs a deeper discussion, though >.<
Frontpage slideshow for instance, they use the media/com_fpss folder to store the source and cached images.
"
I do not know the "Frontpage slideshow" component. Does it have an image manager with upload and other functions?
Maybe we could need a general com_media2 to manage items in a media/my_component/media folder? But the media foler is a very sensitive one. It stores some vital data to the Joomla system not only "media". My case is about a possible 10.000+ stored images.

Regards,
Ove

AJH

unread,
Aug 15, 2012, 3:51:23 PM8/15/12
to joomla-de...@googlegroups.com, Saul Alejandro Martinez Castelo
Thanks for the reply,

I think I should clarify my intent.  In the administration interface of my component, I will be allowing images to be uploaded and associated to certain records.  My controller (or model...haven't decided yet) will handle the file upload and create thumbnails for the images as well before everything is saved.

it seems to me that this sort of information should be stored under /site/components/com_foo/images/...
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.




--
Saul Martínez
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.

Rouven Weßling

unread,
Aug 16, 2012, 1:25:27 AM8/16/12
to joomla-de...@googlegroups.com
Unfortunately we don't have a recommended place for temporary images. The component folder isn't that good a place because assets should be separated from code. (Code should eventually be unaccessible to the web)

Best regards
Rouven

To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/GxSGs_CbxfoJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

Janich

unread,
Aug 16, 2012, 10:51:10 AM8/16/12
to joomla-de...@googlegroups.com
From the cms point of view, this is somewhat interesting topic.

Where do you store public files/images?
Where do you store private files/images?

I guess the easy answer is /media/ - at least for the first question, but how about the second?
Should the cms assist in storing private private data?

Hmm.. Where to draw the line...

Rouven Weßling

unread,
Aug 16, 2012, 11:08:49 AM8/16/12
to joomla-de...@googlegroups.com
Well to me it's currently as followed:

media contains all the assets an extension brings with it at install time
images (which can be renamed by the user so be careful here) contains all the data uploaded by the user that should be accessible to a browser (so for example not images to generate captchas)

What we don't have is a place for generated and temporary files.

Best regards
Rouven

To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/fgOJAInW69MJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

Ove

unread,
Aug 18, 2012, 11:10:34 AM8/18/12
to joomla-de...@googlegroups.com, Rouven Weßling
Hi,
I agree to most of what Rouven wrote.

media should be undrstood as assets for extensions without own path like library and  plug in. Otherwise store assets by the extension: template, component, module.
Wtih images we have the problem that it is public to the editor.

i.e the conclusion
quote: What we don't have is a place for generated and temporary files." added with we don't have a place for not totaly public images.
(might be that the meaning of generated images is the same)

Regards
Ove

elin

unread,
Aug 18, 2012, 8:51:37 PM8/18/12
to joomla-de...@googlegroups.com, Rouven Weßling
Whenever you use a media field you an specify a folder so one thing you an do is to specify a subfolder within images ... this in the old days was the difference between the images and images/folder options where access to folders above story was restricted.

Elin

Ove

unread,
Aug 19, 2012, 2:43:31 AM8/19/12
to joomla-de...@googlegroups.com, elin, Rouven Weßling
Yes Elin,
I'm aware of the possibility to specify a subfolder. This solves the path for my component very well but it does not solve the problem that the path by default is public to any other extension. Or did I miss something?

I so far choose to make the path configurable. It's hard to find "the real solution". There might also be restrictions on user group or user level. There are some possibilities in the available editors to solve this.

Ove
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/t-_hV4IRx1IJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

elin

unread,
Aug 19, 2012, 11:08:31 AM8/19/12
to joomla-de...@googlegroups.com, Saul Alejandro Martinez Castelo
Well one thing I have thought for a long time is that someone needs to use all the features of the media field which include the ability to record created_by, created date etc. That would start to give us some ability to control ownership. Once you start thinking of some of your media as assets in terms of the asset table you can start using ACL on it.

Elin
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.




--
Saul Martínez
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages