3

I am building a Drupal 7 platform where users can share images. In a nutshell, people should be able to comment on images and like them.

The way I realized this is by creating a custom content type called "image" and adding an image field to it. And then I grant users the permission to create "image" nodes.

However, yesterday I came across this Drupal 6 article http://drupal.org/node/325688 and it's section 'Images as nodes'. It introduces the Image module, which lets you upload images as nodes automatically. Unfortunately, the Image module hasn't been ported to Drupal 7.

Q1: Is this the clean way to implement images?

The article also mentions the solution that I made use of:

For example, using Imagefield, you could create a custom content type that contains one CCK imagefield, and configure that field to "contain" (refer to) only a single file. However, note that this custom CCK node type would not be compatible with Image module or its add-ons, and should be named something other than "Image" to avoid confusion.

Q2: Is there any point in not naming your custom content type "image"? I mean, it would be a super suggestive name. And the Image module which would provide a content type with the same name will most likely never be ported to Drupal 7. So there should never be confusion.

Lastly, the article mentions that

It is theoretically possible that, for sites with lots (say hundreds of thousands) of images, storing them all as individual nodes could result in a performance hit from the extra database overhead.

Q3: Well, storing lots of images is exactly what image sharing platforms are aiming at, isn't it? Is there a better way (in terms of performance) to store images in Drupal 7 while still making it possible for people to comment on them?

  • my opinion is, if you want commenets and all the node stuff, it is absolutley ok to create node as a holder for images (you can then have flag module etc.). Everything can be a node :) . I am doing simmilar thing with files (sharing files between users (its educational ;) ). If you expect high trafic then consider dedicated server / clusters, but this is big business then. – NenadP Oct 2 '12 at 13:40
  • 1
    This question is a commentary on an article and several questions in response. On Drupal Answers, it is best to limit a single post to a single question, because if different people answer different parts of your question, it is impossible to award an "accepted" answer. – Patrick Kenny Oct 2 '12 at 13:52
1

The image module does not exist in d7 because this functionality is added to d7 core.

q1. Implementing images as nodes was a clean way to do this in d7. You may still do this in d7. However, d7 has gone a long way and offers the entity alternative. At d6 'everything can be a node'. At d7, 'everything can be an entity'. Nodes were meant to be used for publishing text. They come with a lot of functionality that you may find redundant in your use case. All this extra functionality can slow down your site if you have thousands or millions of entries.

q2. I am not sure I understand why you should not do this. It was probably a suggestion and module specific. In d7 you can name your content type anything you want.

q3. As I told you before, using entities for storing images is a better alternative, as far as the performance is concerned. But then you should implement your own method of commenting.

EDIT: In d8 there is some advances made in decoupling the comment module from node. See this issue.

  • Thank you, it really seems as if the entity approach would be a lot cleaner. And I guess the Media module already takes care of introducing "image" entities, so the only thing that's left to do would be to figure out a commenting solution; maybe making use of the Reply module. However, there is one more thing that I was wondering about: Do you know if there is a way to use the Image module to let users add images merely to the image library? And not to a node or any type of content? It seems to me that the module manages images inside of nodes. – deinqwertz Oct 4 '12 at 14:31
  • I need a simple "upload an image" functionality and not something like "add an image to this node". In other words, where would I put the image field that lets users upload images? – deinqwertz Oct 4 '12 at 14:33
  • The media module just replaces the core upload file functionality. This can be attached to any entity. Node, comment, commerce product are all entities. If you create your own entity, you will be able to add a field with a widget type of 'media' The media module does not create a new entity. I guess you still have the comments problem. There is some advance in d8 about this issue. I have updated my answer about this. – Mike Oct 4 '12 at 14:53
  • The Media module contains the File Entity module (drupal.org/project/file_entity) which, in my understanding, introduces file entities. In particular, with Media and therefore File Entity installed it should be possible to create new file entities (e.g. image entities) without having to attach them to other entites. Please excuse me if I'm getting this completely wrong. – deinqwertz Oct 4 '12 at 15:16
  • I just found out that it is possible, namely by navigating to media/browser and uploading an image to the library. That way the image will not be associated with any node. But I think it'd be great to have some kind of submission form that lets users upload files without having to navigate to the browser. And also when I add fields to the file entity "image", I can only fill in those fields later ('edit file') after I have uploaded the file and the Media module has realized that the file was in fact an image. I think it would be super nice to be able to do this in the first place. – deinqwertz Oct 4 '12 at 17:57
0

If I understand your issue correctly, Bulk Media Upload or Bulk File Nodes modules will do what you want.

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.