Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-1.x-dev
Component:
General
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
18 Feb 2006 at 19:11 UTC
Updated:
2 Aug 2006 at 22:16 UTC
Jump to comment: Most recent file
Comments
Comment #1
120@drupalfrancais.zapto.org commentedI've tried to code an image field type.
Comment #2
120@drupalfrancais.zapto.org commentedbut I didn't expect this form to behave that way so here is the second file.
Basically, you must provide an image URL and optionally a link to associate with your image.
The image will appear floating next to the following paragraph/link/whatever.
If you provide a global variable $side it may change the div class. That is, I developped this for my website (www.ate-ne.ch/drupal for now) and I have kind of a special node.tpl.php which sets a global variable called $side.
If $side=0, the image will float on the right side and if $ride="anything else", it'll be on the left side.
My code also assumes you've gallery2 enabled, so I'll have to had some kind of check-up in order to prevent errors if you didn't install gallery2.
Comment #3
120@drupalfrancais.zapto.org commentedLast info:
it defines classes which are:
floatimage-left
floatimage-right
Comment #4
120@drupalfrancais.zapto.org commentedwell ... no ... define is not the right word ... I should say "is sensitive to".
Anyway ... so tell me you thoughts about it plz so that we can code something clean, robust and efficient.
Comment #5
120@drupalfrancais.zapto.org commentedrelating to the question appearing on top:
I use drupal 4.7rc2 (+a few cvs modules ... node + taxonomy but it makes no difference to me). And cck cvs (from a few days ago so must be around the 10th of april).
Comment #6
jonbob commentedNeat ideas, but CCK won't ship with anything that has external dependencies on projects such as Gallery. Feel free to submit this as a separate project that depends on CCK.
What we're looking for in an image module is a fairly simple upload mechanism. I believe dobry has one about ready now in his sandbox.
Comment #7
sami_k commentedhttp://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/dopry/
That is very cool!
Comment #8
scroogie commentedAn own hardcoded upload? Why? Why not use the image.module?
Comment #9
coupet commentedgreat for images, but thinking about other media or files type including: audio, video, pdf, ..., and others
Comment #10
sami_k commenteddobry is working on a patch, like to his sandbox above, that provides an actual image field. He said that he's essentially going to generalize that to a file field for 4.8 because essentially image is a file field with certain functions, and so that I guess could be abstracts using certain functions for other file types.
Comment #11
tema commented#8> Why not use the image.module?
+1
nodereference.module can attach any node type, just fix a page/teaser display for image nodes.
Comment #12
sami_k commentedAbout using the node reference, it's not the same and is in no way ideal for a community site that accepts content from people as the node reference type does the restrict what you can attach by for instance user. You could create new code to do that, but an image field is the best solution.
Comment #13
RobRoy commentedI'm scratching my own itch and doing some work on this. I got dopry's from his sandbox and will try to extend it a bit. Any advice is appreciated.
Comment #14
sami_k commentedDopry's module is already pretty much complete, the only thing I recommended to him was to add a thumbnail feature like the one that's found in the current flexinode image field, but he essentially said rather validly that there is another module called imagecache that can be used for this purpose more effectively... I still think that this would be a worthy addition, multiple sizes for each upload like currently is the case with image.module. Go ahead and e-mail Dopry and you guys can talk about your ideas... He's rather open to discussion and perhaps you guys can collaborate.
Comment #15
jonbob commentedYes, please collaborate on this. I want to get an image field committed ASAP, and multiple variants floating around will only hinder this effort.
My preferred solution is to get something *simple* and *stable* committed, then start adding features. If anything in the framework design hinders this project, please let me know.
Comment #16
dopry commentedI'm working on simplying the imagefield module to use content.module to store the fid. Once that is done it should be ready to commit. I'm having trouble figuring out how to pass the field back... I may just attache an [images] array to nodefield. I'll figure it out in the next few hours. At the head of the module should be 3 todos... If anyone wants to pick one please go. I plan to commit imagefield as my first real contrib module on my bday tomorrow.b :)
Comment #17
sami_k commentedHappy Birthday! Thanks for the hard work with this field, it's really needed!
Comment #18
RobRoy commentedDopry,
Yeah, I didn't do any branching. Was going to submit patches, but it looks pretty good. I made a few minor changes, but I'll wait until you commit a working version to the sandbox to submit a patch (your last comment says 50% working version).
What about allowing for users to Browse..., pick image then when hitting preview/submit it uploads that file. Some of my users are going to choose the file then just click save and not think to hit "Attach".
Good work though, this is highly useful.
Comment #19
dopry commented@RobRoy,
The uploader/file browser concept I'm working on as patch for core... It gets a little deeper into drupal's file handling than imagefield. However, with imagefield if you just click submit it will attach. :)b
Comment #20
coupet commentedThe name says "image field type" but I am thinking "file field type" or "media field type".
feature requests for image specific media type, interested in audio, podcasts, and other media types.
Comment #21
rory-- commentedQuestion about this: Will Views be able to sort CCK images in a gallery format, like image.module already does?
Comment #22
sami_k commentedronoxQ: No.
Comment #23
rory-- commentedHmm... then maybe that'll be something that I'll work on once this is made for the CCK officially. Any idea on what time that'll be, so I can put it on my schedule?
Comment #24
rory-- commentedSorry for the double post.
Is it safe to use this module from Dopry as-is for CCK right now? Or will I have to completely scrap it once the CCK version gets released?
Thanks for the help!
Comment #25
dopry commentedYou can use one of the older working versions that uses it own fid table. The version that will officially be released with cck will use content.module to store the fid. There will be incompatabilities but a few SQL queries should be able to migrate it.
.darrel.
Comment #26
marcoBauli commentedAbout #14:
+1 for thumbnail feature (and eventually third 'smaller-than-original' picture) àla image.module. That's pretty fundamental.
Tryed to have a look at that imagecache module, but couldn't find it anywhere (looked also in the cvs repository, but wasn't there). Anyhow the principle is always the same: less modules, less configurations, less mantainment, more joy ;)
thank you
Comment #27
dopry commentedWell you know. imagecache has disappeared. I'll put it back in cvs tonight.
The new head of imagefield.module in my sandbox is almost usable.
content.module is not storing fid. I'm working out the details of multiple value support.
It should be safe for adding a node right now. Updating and deleting are broken.
Comment #28
dopry commentedHoly Stinging Insects batman...
Imagefield should do most of what it is supposed to, aside from some funkiness with the ui for multivalues.
We'll revisit a finalization tomorrow.
Comment #29
David Lesieur commentedDopry, I like this! Thanks for this work!
I did some quick tests and it seems to work well, except for the multivalues (you already mentioned this), and for revisions. For example, if an image was marked for deletion when saving a new revision of the node, the old imagefield's vid and fid are nicely preserved in the field's data, but the image is removed from the files table. Thus, we do not get the images back when reverting to the old revision.
Comment #30
dopry commentedack revisioning... hrm...
I'll have to look into the best way to test if all revisions are removed.. JonBob, have any suggestions for quick ways to use content.module to find out if an fid is still in use?
Comment #31
Patrick Nelson commentedDopry,
I'm probably just being dumb, but I've downloaded the latest version from your sandbox and created the table using 1.2 of imagefield.install.
I've enabled the imagefield module but imagefield doesn't appear in my CCK list as a possible field type that I can use.
Am I missing something / doing something wrong?
Comment #32
Patrick Nelson commentedI was right! I AM dumb!
Clearing the cache helped...
Sorry for the pointless post.
Comment #33
Patrick Nelson commentedFound something useful to post... :)
I've got it working now - and it's brilliant! Yay!
Question: I use seperate theming for my CCK nodes. What's the code to display an imagefield in this way? For that matter, how do I display multiple images (users can add multiple images in one of the CCK types)?
Regards
Patrick
Comment #34
Patrick Nelson commentedHmmmm.... an interesting 'bug' here. When I upload an image to a CCK node, I can browse to the image and click Attach without any problem but I get the message below at the top of the screen after I Submit the node.
The image is still there in the node and doesn't seem to have any problems - nothing reported in watchdog either.
Puzzling...
Comment #35
Patrick Nelson commentedOne other thing too. The weighting in the node submission form doesn't seem to work for image fields. It actually appears at the bottom in the middle of all the other stuff down there (like authoring info, etc.)
Comment #36
David Lesieur commentedPatrick,
The message you see after submitting a node is only a debugging message to help developers (because this module is still undergoing heavy development). You can get rid of this message by removing line 147 (the call to drupal_set_message) in imagefield.module.
Comment #37
Patrick Nelson commentedMany thanks, David.
That's done it.
Regards
Patrick
Comment #38
Patrick Nelson commentedDoes anyone have an answer to comment #33 above, i.e, what's the code to display an imagefield in a customised node template?
Comment #39
Patrick Nelson commentedI would have thought that the ability to do this was quite important. Does no-one know how to do this for imagefields?
Comment #40
Dublin Drupaller commentedGreat work on the imagefield.module...Dopry. Fair play to you for getting it this far.
Patrick (Nelson): I too am trying to work it out (how to insert an image).
I've been playing around with imagefield.module with 4.7 and couldn't get it to work for me..but..I did manage to get a node-content-name.tpl.php file to display the Alt text by using this;
I'm guessing that the following should display the picture/image, but, I'm only guessing...I'm not sure if I should be testing imagefield.module with CVS or 4.7.
I agree with others that this is a pretty crucial field to get sorted..many users who used flexinode in the past would be held back from upgrading because it's clear on the site that cck.module replaces flexinode.module and I imagine an image field is pretty important for some.
Any1 else get the imagefield.module working with 4.7?
Dub
Comment #41
eaton commentedUsing contemplate.module is a great way to poke around at the internals of a given CCK content type you've defined. Even if you end up putting all your hardcore theming code into node-type.tpl.php, contemplate helps you poke around at the data structures.
For me, the following code seems to work smashingly:
Comment #42
Dublin Drupaller commentedthanks Eaton..but I can't seem to get that to work for me...I think your snippet looks right..but, when I "attach" an image to a CCK content node it appears to upload okay (a thumbnail appears and 2 text fields appear for title and alt text) but when I SUBMIT the image doesn't display.
I tried deleting the node-content-name.tpl.php override to see the default..but that wouldn't work either.
Are you using Drupal 4.7? Can you post up your version of the imagefield.module here ?
cheers
Dub
Comment #43
eaton commentedHmmm. I just looked, and realized that I'm using an older version of imagefield.module (1.22 from 5/25, rather than 1.26 from 6/7) and the CVS version of CCK rather than the DRUPAL-4-7 tagged version. My drupal installation is DRUPAL-4-7, though, so the CVS version of CCK should be okay on that version.
I'll check with the latest imagefield.module and make sure my snippet still works OK.
Comment #44
jjeff commentedFYI, ImageCache can be found here. Not very end-user friendly... but hugely powerful for site developers and themers.
I like this approach and we should probably consider this as a sizing solution for CCK imagefield.
Comment #45
David Lesieur commentedThe imagecache is interesting, but I'm wondering... This lets anyone who knows the URL generate any size for any image; do we really want that? Could passing such informations on the URL open potential security issues? Why not use an API?
I'm not opposed to the idea. I'm just looking for explanations. ;-)
Comment #46
dopry commentedre: imagecache
-- imagecache needs a throttling mechanism. It is a known dos vector without one. I'm less concerned about the security issues. I'm pretty sure I'm sanitizing the input. If not a quick check_plain will cover it.
Please post feature requests, bugs, and questions for imagecache in the imagecache project. I need to figure out how the throttling or permissions will work.
I haven't added support to imagefield for generating thumbnails and derivative content, because I want to spend more time focused on my filesystem.module. Which will enable all kinds of fun through hook_filesystem, and simplify a lot of the work that is currently required for file handling.
re: imagefield
Imagefield is largely ready to go. As of today I think most of the bugs are ironed out. Multiple and single values work well, files are being deleted properly, required values work. (I'm pretty sure there is a bug that will allow you to delete the last image in a field on submit without being caught by the validation routine.)
If you have time please test and comment on it.
@JonBob: can we get it added to cck proper at this point? I think its ready for an initial release.
Comment #47
Dublin Drupaller commentedHi Dopry..
Just tried it (latest version of imagefield.module // v 1.29 2006/06/07 23:31:40) with Drupal 4.7.2 and everything seems to work okay except it won't display the image when viewing the node.
Is it supposed to work with Drupal 4.7 or should this thread really be tagged as CVS?
Dub
Comment #48
Patrick Nelson commentedAs far as displaying the image in the node is concerned, I've finally managed to achieve this. The answer is in this short node here: http://drupal.org/node/67730.
I cannot guarantee that this will work with the latest version of imagefield, I'm using v1.22.
Comment #49
Dublin Drupaller commentedthanks Patrick..are you using Drupal 4.7?
Dub
Comment #50
dopry commented@Dub
It should work for 4.7, as far as I know all cck development going on currently is geared toward the 4.7.x releases.
Is there anyway I can take a look at your site? Hopefully I'll have this in cck proper soon, and be able to use the issue queue.
Comment #51
Dublin Drupaller commentedyep am using 4.7.2...cck.module and imagefield.module installed...
everything appears to work...but the images don't display.
I'll drop you a quick email with a link to the dev. site
thanks
Dub
Comment #52
zach harkey commentedI need this feature asap. Who do I need to grea$e (and with how much) to push this feature over the finish line? Let me know.
Comment #53
Dublin Drupaller commentedJust in case anyone else is treting the imagefield.module...it only works with Drupal CVS..it doesn't work with Drupal 4.7..
I just tried it on both. It works with Drupal CVS, but not drupal 4.7.
Dub
Comment #54
Dublin Drupaller commentedZach: the imagefield.module is almost there..it appears to work fine with CVS..it just needs to be tweaked for 4.7 (I think it requires changes in the CCK.module as well for 4.7 - there is a number of noticable differences between cck-cvs module and the cck-4.7 module).
Fingers crossed that won't take too long.
Dub
Comment #55
sami_k commentedcvs seems to work fine with drupal 4.7.2, so you might consider updating your cck module to cvs and trying it out.
Comment #56
Dublin Drupaller commentedThanks Dopry...but the CVS version of CCK.module doesn't work with Drupal 4.7.2
Dub
Comment #57
Dublin Drupaller commentedSorry..I meant "thanks Samik"....
retagging this thread for CVS. (it was 4.7)
Dub
Comment #58
nicholasthompsonThere doesn't seem to be an install method - only update... Its making it pretty hard to install!! Or am I being thick?
Comment #59
nicholasthompsonBeing thick... How come you can search for hours for something then as SOON as you post about it anywhere, the solution slaps you with its velvet golve...?!
Answer: The install does nothing, all handled by the content module now. I made a mistake with the database so had to delete and remake the field.
Comment #60
nicholasthompsonI appologise if this is spamming of any kind - but does anyone know why I'd be getting this error?
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/html/drupal/modules/cck/imagefield.module on line 172
Comment #61
marcoBauli commentedDoes not work for me neither on 4.7.2.
As soon as i copy the 3 files into /modules/cck, i get the following error:
Fatal error: Call to undefined function: _content_fields() in /home/kiteatla/public_html/drupal/modules/cck/imagefield.install on line 65while if i remove the imagefield.install file i get:
Fatal error: Call to undefined function: _content_fields() in /home/kiteatla/public_html/drupal/modules/cck/imagefield.module on line 471Comment #62
dopry commentedCan you please include the cvs version of imagefield.module you are using.
re: undefined function _content_fields. Do you have a recent cvs version of cck as well?
Comment #63
jjeff commentedI think I saw this error as well. But I think it's in a function that only gets called when Views module is enabled.
here it is
Line 471
Change
_content_fields()tocontent_fields()and everything should start working again.Comment #64
marcoBauli commentedYes, I am on the latest CCK cvs (13th may) and the latest imagefield (1.30).
I just:
1. changed
_content_fields()tocontent_fields()in imagefield.module and imagefield.install2. updated database
3. erased and re-added my image field just to be sure the table had the right fields stored.
Now update.php does update all my cck tables without errors (before it stopped giving fatal error on line 65 above).
Image field now does show in the form (no more fatal error), but once i attach the image i do not get any preview of it (in my /files/tmp directory the preview file has not the .jpg extension, may that be the cause?), nor i get any image back when i submit the node.
NOTE: the weird thing is that before doing point #3 above, at least the thumbnail appeared even if the following error was displayed:
user warning: Unknown column 'field_picture_fid' in 'field list' query: SELECT field_picture_fid AS fid, field_picture_title AS title, field_picture_alt AS alt FROM node_content_spotccx WHERE vid = 390 in /home/kiteatla/public_html/drupal/includes/database.mysql.inc on line 120.hope this can help somehow, thx
Comment #65
marcoBauli commentedtryed some more:
looks like the imagefield.module created /files and /images directories in ROOT, while in my 'File System Settings' (/admin/settings) i have
sites/kiteatlas.com/filesas my file system path, andsites/kiteatlas.com/files/images/tempas temporary directory.I guess (i am no coder!) this discrepancy misleads the module that can not find the image files.
Deleting the two folders in ROOT i get my image back in the node, but not yet the preview image.
PS: it would be nice to be able to specify our own images directory path similarly to how it was possible with the image.module
Comment #66
tones commentedI'm also getting this same error:
I'm running the latest CVS HEAD imagefield.module
Comment #67
sami_k commentedchange the name of the function to content_fields() as this change was made in the content.module
Comment #68
morphir commentedWe could use imagemagick to resize pictures into thumbnails. As it's done on image.module. What you think?
Comment #69
forngren commentedI agree, I think in the long term CCK should replace image/page/story and simular modules. To do this we must first implement their features.
Comment #70
sami_k commentedThat actually was more over the purpose of the CCK to begin with, it's suppose to end up in core. Dopry is developing a generic file field which will do the file handling and then we'll pretty much be set. Currently, all the other primitive content types except perhaps forums, can be implemented with CCK. CHX is developing a gaint patch, I dunno if he's finished, that will integrate CCK and Drupal Core.
Comment #71
chx commentedHe is not. First, http://drupal.org/node/62340 only lays some groundwork, second, the torch is passed on to Jaza now.
Comment #72
ardas commentedGreetings,
I would like to discuss another simple but useful feature:
That will be good if I can specify a folder for storing images per each content type. This is especially needed when working with 5-10 product types each of which have from 1000 till 5000 product instances. It is 5000-50000 image files. It is inconvenient to have all of them in "files/" directory.
What do you think ?
Comment #73
introfini commentedYes I also agree, that feature is a must have.
Comment #74
dopry commenteddirectory hashing and physical file storage is a completely seperate issue. I'm doing a bunch of development in that area. If you have additional features you want in imagefield, feel free to submit a patch, but it does excatly what I want and need it to. It provides a basic way to attach an image to a node, and resize it to fit within a layout.
Comment #75
kickn commentedAny idea on when this will be release with CCK?
Comment #76
dopry commentedWhen JonBob is back around and approves for it to be moved into the repository. and adds it to the project.
Comment #77
marcoBauli commentedResume
follows a brief list of the pending feature requests that can be found above:
* Multiple image sizes from each upload (#14)
* Lost images in old Revisions (#29)
* Weighting does not work (#35)
* Thumbnails generation (#68)
* Define default file folder per content type (#72)
To these i'd add my own:
* Transform upload form into a normal field (instead of collapsible form item).
I find this more friendly and integrates better with other fields into submission forms (or well, maybe is just me...!)
Should add big Thank You Dopry for all the efforts till here!
Comment #78
RayZ commentedNow that a separate project has been set up (http://drupal.org/project/imagefield) these should be filed as separate issues there, and this issue should probably be left to rest in peace.
Comment #79
coupet commentedPlan to create a project for Filefield module?
FileField module
http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/dopry/
left to rest in peace?!~
Comment #80
dopry commentedre: filefield....
filefield is waiting on my new filesystem.module to be complete... It will provide a lot of the underlying infrastructure for filefield to be a real step forward. Imagefield will also be rewritten using filesystem.module when it is complete.
Comment #81
dopry commentedImagefield is its own project now. And it solves the need for an imagefield module for cck.
see: http://drupal.org/project/imagefield
Comment #82
(not verified) commented