9

How I should understand difference between images and media directory? In all my Joomla! sites I was using images for image files displayed in articles, media for PDF's, MP3's etc. Names of these directories led me to do so.

(1) If I have 600×900 px (portrait) banner image which on click goes to 6000×9000 image suitable for large-format printing, should the former go to images and the latter to media directory?

(2) Name media evokes me either abstract media type (PDF, EPUB, MOV) or CSS-like display media (paper, screen, mobile device) or storage media (DVD, HDD, CD). How should I understand directory name media from Joomla! viewpoint? What media are expected inside?

(Main) What is the main rule for decision which directory to use for what?
 

More than simply learning DO's and DON'Ts my goal is to understand intention of Joomla designers for these directories.

0

3 Answers 3

12

media is mostly used for

  1. images, script and stylesheets which are served with component and plugins. (These are part of your website source-code)
  2. Content of this folder can be overridden by template
  3. for examples your website-logo is part of source code

But image folder is used for

  1. images in content written by admin/users.
  2. Its safe to assume images folder for user generated contents.
  3. for example your website users upload there profile pic, these should be stored in images folder.
7
  • Honestly, the explanation is too short for me to understand. What exactly do you mean by point 1 and 2? Should I never use media by myself? What about second question I asked? And where to store MP3's, PDF's etc.?
    – miroxlav
    May 5, 2014 at 8:00
  • Store mp3, pdfs, etc to image folder. As these are content of website, rather than part of source-code. May 5, 2014 at 9:11
  • Short answer is, it is up to you. You need to manage the site and administer it, which is why it is most likely a bit vague because there is no right or wrong way.
    – tim.baker
    May 5, 2014 at 12:52
  • You could add that the extension installer makes it easy to store extension assets (javascript, css, images) into the media folder, but not into the images folder. media is indeed for extensions, while images is meant for the user.
    – Bakual
    May 5, 2014 at 13:38
  • 1
    I have experimented with a third folder (/files) for documents, leaving the image folder for images. Then changing JCE so that it used /files for documents. But it creates more problems as you want the JCE file manager to be able to manage all types of files, including images, so I wouldn't recommend it. The name media could have been better labelled conceptually as extension-images. It also serves javascript, and you don't want end-uses modifying that. May 5, 2014 at 22:34
8

Clients don't have access to the media folder by default. JCE, media manager, a number of galleries and banner sliders, they're all looking to the images folder for content data.

We care more about making things easy and streamlined for our clients and keeping them out of trouble than we do about putting things where we're told, so we use images as the main content media folder. Inside we keep a "files" folder so they can upload pdfs or documents, and we let them organize images and other file types as desired. Background and layout images are kept elsewhere so they can't really destroy their site. Because they're not being permitted to travel outside the images tree, they can't go wrecking stuff.

There's no way we'd want a client to have any access to the media folder. That's for plugins and components to access, not the content writers. Even as a developer I rarely need to go in there and do stuff.

So moral of the story - media is for the CMS, images is for the CONTENT.

2
  • Using images folder is ugly, but you are right, we don't want our users to be able to access /media folder and broke the website with few clicks. We would need a new folder in Joomla, something like media_user.
    – Adam M.
    Aug 12, 2016 at 15:15
  • Anyway if you users doesn't need to browse files and you can handle everything with your component, then media can be used for both component's files and user generated contents.
    – Adam M.
    Aug 12, 2016 at 15:22
0

More than simply learning DO's and DON'Ts my goal is to understand intention of Joomla designers for these directories.

What they intended can be found on https://docs.joomla.org/Development_Best_Practices under Where should I place JavaScript, CSS, and Image files that belong to my Component? and Where should I place files generated by my Component?.

Because of overriding all images, scripts, stylesheets generated by your components, should be included inside media folder. But the interesting thing is that it also mentions about user files generated/uploaded thru your component. For Permanent, web accessible files it says Use a subdirectory of the media folder. And then This applies to all files handled by your Component, including files your code generates and files the users of your component upload / generate.

They doesn't mention in this 'development best practices' guide anything about the image folder, so I assume it's intended for non development stuff like uploading your images to use in the articles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.