3

My question may seem vague but I'm confused and need advice on Drupal 7 media files management, so please bear with me. I'm looking for existing modules or ways to build the following functionality with minimal effort:

1) Image management. I'm building a site that is mostly text articles with a random image or two scattered here and there (an average Wikipedia article may be a good example). I want to be able to

1.a) insert scaled image thumbnails into my text and provide an explanation of what is in the image right under it (exactly as they do in Wikipedia). This doesn't seem to be standard Drupal feature when handling images.

1.b) if it is possible I also want my image thumbnails to be clickable with links leading to original unscaled images (again something that can be seen at Wikipedia, though they first lead you to another page that contains image information and copyright status).

2) Media file management. Sometimes I want to attach a file to an article that browser itself won't handle, something like .mp3 or .pdf. If I simply add a File field to an article, it won't offer any protection against anyone who decides to download it. Can I possibly make downloading a file a bit more complex - like forcing a visitor to enter captcha first?

1

Ari,

Let me start off by saying that media files (images, videos, etc..) attached to nodes, Meaning they are acctually uploaded when entering in a node content, those files are stored in the default file folder (usually 'sites/default/files' ), unless that field in the content type specifies otherwise.

Example: If i create a content type called 'blog entry', I would add a field to that content type called media. When you get to the screen where you can edit the field information, you can select accepted file extentions, where the files would be stored in relative path to the default file location in your sites file location settings (again, usually: sites/default/files)

I would make this file location 'blog-entry/media' for this new field in my new content type. So my files would upload to: sites/default/files/blog-entry/media when i uploaded them during the addition of content.

The thumbnail settings are somewhat default and can be adjusted under the display settings for the content type. THere are default thumbnail parameters you can select from, or you can add/remove thumnail options in the site settings as well under image settings

Once you get a hang of this flow you will see how easy it really is to manage media.

Another module worth looking into (after you have done the above, so that you may understand what the core of Drupal is doing with your media files), is the Media Module. It makes uploading and managing a little easier than core.

Also to note: stay away from Media Gallery right now.. its a mess as of this week.. most bugs should be resolved sometime next month.

  • Hmm. I've learned how to add image fields to a context type, make images appear as thumbnails in articles and link to original unscaled images. That's good but not enough. First, there is no way to tell Drupal how I want a particular image to be aligned (i.e. should it be float:left or float:right or something). I can override CSS, that's granted (images come wrapped into several DIVs, and there are "even" and "odd" pictures), but it either cause all pics to be aligned the same way or "even" images will be aligned one way and "odd" will be aligned another. – Ari Linn Dec 24 '11 at 8:14
  • What is more annoying, I can't tell Drupal where exactly I want to place an image. In wikipedia or you can type a huge block of text, then insert an image tag, then type another block of text and have an image between the two paragraphs. I don't see anything like this in Drupal. All images are crouded either before or after article body. And I still haven't find anything remotely like adding explanatory notes under my images. I also installed Media Module though it doesn't work for me: I got a bug (drupal.org/node/1142630) that is still not fixed. – Ari Linn Dec 24 '11 at 8:16
0

Seems like there is no straightforward solution to either of my questions. Here is what I've found:

  1. For handling images and placing them where I like I now use the Insert module. It works with popular WYSIWYG editors but I personally hate WYSIWYG and prefer raw code. The Insert module relies on content type fields, but allows user to choose where to place uploaded image. After installing the module, I went to admin/structure/types/manage/%yourcontenttype%/display and set "Image Label" and "Format" to hidden; this prevents images from showing before or after your text body. Then, I just used the "Insert" button that appears in article edit form. I couldn't find how to make it insert clickable previews or wrap them into style-able DIVs, so I had to do it all manually. The Insert module generates something like this in the article text:

    <img src="http://yoursite.com/sites/default/files/styles/medium/public/images_in_articles/bla-bla.jpg" alt="Bla" title="Bla" class="image-medium" />
    

    I then manually write code that surrounds image preview:

    <div style="float:right"><a href="/sites/default/files/images_in_articles/bla-bla.jpg">
      <img src="http://yoursite.com/sites/default/files/styles/medium/public/images_in_articles/bla-bla.jpg" alt="Bla" title="Bla" class="image-medium" /></a>
      <div>Explanation</div>
    </div>
    

    It doesn't look nice, but it does its job well.

  2. As for forcing users to enter a CAPTCHA on file download, there is also no ready solution. I've found a module written by some Russian guy for Drupal 6-x and 7-x, but I have yet to look into it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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