As i see there is a potential need to discuss this, i have open the ticket.

Why creating entitys for images?
1. The biggest reasons here is the storage of meta-data information. You could press them all into the image tag, using whatever, alt with some weired syntax like alt="name=value|name1="value" but this will not last long and is semantically pretty bad. The most important argument here is the dialog itself.

2. To load a image-detals form, where you can change such informations, needs you to pass those values by _GET. Why? because you can use ajax post to load the iframe. Technically this would be possible, but as we dont change the location.url then, its not a reload and all our css / js in the dialog wont be working and thats actually excatly what is so interesting on this dialog. We have a complete working bootstrap without hacking arround. Using entitys (use entries) i can pass a ID only (one get argument) all the other information is fetched out of the entity + entry

Why use a node as storage for that entity
Well this is the most argueable point actually. One of the biggest reasons here are the possible use of imagefield. This makes this node really handy. You can replace the image, and it will be replaced in all content. This also makes a new meta-data possible called "version" which lets you choose whether you want to link to the newest or exactly that version of an image. In addition you can use all the bulk operation and you share your code with one of the most spreaded modules (regarding to the usage statistics). So this would keep this module small, using modules which are very stable (imagefield, filefield)

Using imagefield lets us the use filefield getid3 later, to extract exif information

But the most important reason for that idea is the customization. So you can use normal alter methods, you can use the nodeapi and all that stuff to extend the meta information shown on the user interface in the dialog ( in the advanced field ). So this makes the module widely usabel. Also implementation where you can select a part of the image to be used are simpler possible then.

Well i see this point that this can become have, i mean using node as a storage. But yet i urgently see a need for those an entity in general. Iam very please to hear any arguments

Why do we need a additinial relation"image entry":
Well this is mostly because of even if you use a specific image entity at one place, you will probably change :
- which preset is used
- what style should be used
- whether lightbox should be used to show a big size image
- whether it should be version-sensitive or not
( - Title)

So those meta-data is use-specific. You can use a image several times, while using different meta data of those fields above. So eventhough we have an image-entity which stores all the hard facts like filepath, author, title you will need to have so a container, which stores the "use settings"

Where the heck should all this extra field go
Dont be scared, one of the most important things i care about is usabilty and simplicity. So the dialog will stay nearly the same as now, but will become a "Advanced" tab" which will present all this extra stuff. So the general user will not be confrontated with all those things.

Also things like id3, fancy cck fields and things should become submodules and dont need to be activated for every installation. So you can keep your usecase very small - if you like to.

Comments

tuffnatty’s picture

Sorry I could not understand your text as a whole, but... Basically, I don't see why all the metadata can't live in wysiwyg_imageupload table. Storing images as nodes is heavy, and imagefield is not so heavy but its metadata is stored as a serialized array in database column, which makes sql queries on that metadata non-efficient.

eugenmayer’s picture

Well actually they can, the problem then is, that we skip all the node architecture. In you statement thats positive because it gets lightweight. Well this is correct.

But the other side is, it also loses all the extenability. I would please you to read the whole text, not to skip parts :) Take your time :)

In any way, beside that, thank you for you help!

tuffnatty’s picture

Can you please describe in more detail the storage architecture you want to implement? Like:
1) Should user provide a multi-value imagefield which will contain all embedded images?
2) How can other modules (e.g. an image browser plugin for wysiwyg_imageupload) query this info? I am currently building such an image browser consisting of a text entry and a carousel displaying images whose filename/title/alt/description match the string entered in this text entry, like this: SELECT f.fid, f.filename, f.filepath, w.description FROM {files} f LEFT JOIN {wysiwyg_imageupload} w USING (fid) WHERE f.filename LIKE '%%%s%%' OR w.description LIKE '%%%s%%' ORDER BY w.description, f.filename. Will it be ever possible with imagefield?

eugenmayer’s picture

1) No, one Image Entity is one node, with one Imagefield with one image inside. No multivalues. So this entity represents exactly one image (beside its presets).

2) I will provide an API to easily query those images, but you can use the node api + cck api yourself also.
Just some examples

// get the image
wysiwyg_imageupload_image_entity_image($nid) ..

// returns all nodes, this image is used in
wysiwyg_imageupload_image_entity_used_in($image_entity_nid)

// return all images entries (usage of this node)
wysiwyg_imageupload_image_entity_usage($image_entity_nid)

// replace or add the $file (image) as new entity. This always creates a new revision
wysiwyg_imageupload_image_entity_replace($nid,$file)
eugenmayer’s picture

Title: Store all images in nodes using imagefiled » Store all images in nodes using imagefiled? Discussion

I will anyway use a different branch for those changes, 6---2-0 so people wont lose that simplicity you also might like.

tuffnatty’s picture

Wow! That's an answer I really like! I don't have to fork you ;)

eugenmayer’s picture

you mean #5 or #4 ?

tuffnatty’s picture

#5.

eugenmayer’s picture

So you are not going to support the other approach? If you like to co-maintain the 6--1-0 "keep it simple" branch, let me know. I give you CVS access! You would and have helped me a lot. Spaciba dawaresch. Ja radilsa b almate :)

tuffnatty’s picture

As for the "complex storage" branch of wysiwyg_imageupload, I'd wait for Media module backport to D6, or help to do it, as it's the API everybody will be probably using in D7. #631944: D6 version?

eugenmayer’s picture

stborchert’s picture

I prefer the method of creating one node for each image.
This gives you the flexibility of adding more meta fields (or whatever) to the image itself (think of tags or flags [e.g. "I like this image"]) or output a list of this images using views or ...
One disadvantage of this solution is multiple uploades at once. But this may be solved with a custom input form (or a module I'm currently developing for D7 ;) ).

eugenmayer’s picture

Well multible uploads are not affectd by those one image one node approaches. Thats currently a browser-sandbox problem only solved with Flash or GoogleGears ( or in the newer browser ). So if you use image_fupload, you can still have both approaches.

tuffnatty’s picture

Title: Store all images in nodes using imagefiled? Discussion » Store all images in nodes using imagefield? Discussion
Flying Drupalist’s picture

I much prefer having one node per image. Just my 2cents.

igorik’s picture

I prefer to use imagefield, and it's api and for storinhg/showing/deleting images (as I wrote in my fiorst issue).
I think that this is the way we should go. D7 have fields in the core and using fields (for views etc) is then easy and slimple.

sagannotcarl’s picture

Personally I think that using one node per image is overkill, plus you would have to write all your own relationships / views integration whereas right now just letting this be a cck field give you lots of views possibilities more quickly. What about using imagefield on the node that you're adding images to and using this module as an interface for that field along with inserting it into the text area?

For example, I'm currently using imagefield + insert module (http://drupal.org/project/insert), but it doesn't integrate into the wysiwyg editor the way your module does.

The big advantage that I see with this is the ability to use imagecache (along with the out-of-the-box views integration I mentioned already).

eugenmayer’s picture

@17:
thats exactly what i splaned. A node for an image, the image is stored in a imagefield. That also gives us the lightbox integration etc.

eugenmayer’s picture

Title: Store all images in nodes using imagefield? Discussion » Implement a node<->image relation for branch 2 (with imagefield and so forth)
Priority: Normal » Critical
eugenmayer’s picture

Status: Active » Fixed

implemented in 6.2.0, eventhough its not a node<->image relation, but a custom more lightweight entity

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

eugenmayer’s picture

Status: Closed (fixed) » Fixed
Flying Drupalist’s picture

So this means no voting on images? Sorting into galleries, or commenting?

eugenmayer’s picture

this means that you have a api now to attach those images to nodes and do those things you like :)

eugenmayer’s picture

Status: Fixed » Closed (fixed)
Flying Drupalist’s picture

Can you explain how you do this, I mean attach images to nodes.

eugenmayer’s picture

Create a new issue for that :)