Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
This is my first patch for Drupal. I've actualized Killes' flexinode/field_image.inc for
to do thumbnails for the uploaded files. Thanks for Chx for the instructions :)
--
Aries
Comment | File | Size | Author |
---|---|---|---|
#29 | private_thumbs.patch | 10.28 KB | RobRoy |
#27 | field_image.inc.teaser_image1.patch | 740 bytes | fax8 |
#14 | flexinode_image_thumb3.diff | 10.23 KB | Cvbge |
#13 | flexinode_image_thumb2.diff | 9.93 KB | Cvbge |
#10 | flexinode_image_thumbnail.diff | 9.55 KB | Cvbge |
Comments
Comment #1
Zach Harkey CreditAttribution: Zach Harkey commentedDoes this work ok? If so, what are the odds of this getting built into the module? The fact that the flexinode settings ask for a specific thumbnail size and even path to imagemajick, implies that they might actually be used. However, for as long as I have used this module, I've never found any evidence of thumbnail creation.
If there is no intention of generating thumbnails for images, could we at least kill those fields in the settings? I know it would have saved me a lot of futile troubleshooting and experimentation.
(Alas, I really don't expect anyone to answer or even acknowledge this comment, I just wanted to get something on the record so other theme developers don't think they're going crazy when their teasers could care less about their thumbnail settings.)
Comment #2
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedzachharkey, can you confirm that it works? If yes, I'll apply it.
Comment #3
cidenton CreditAttribution: cidenton commentedThis patch works in terms of generating the thumbnail file (although getting it to work on Windows required an additional modification because imagemagick tries to interpret c: in the filepath as an image format descriptor), but does not actually show the thumbnail in table view because flexinode_file_download does not accept the file when the img url loads. I am just fininshing up some pretty simple modifications to make this work. I am new to this development community; how should I proceed once I have this working? Should I post a complete patch relative to field_image.inc and flexinode.module or vs. this patch?
Thanks,
Claude
Comment #4
Marandb CreditAttribution: Marandb commentedAny update on this? Looks as if it will be a valueable / must have feature. Couple quick questions.
Does the patch:
- make every image field a thumbnail (clickable to full size)?
- make an image allowed in preview a thumbnail?
Thanks,
Marand
Comment #5
Egon Bianchet CreditAttribution: Egon Bianchet commentedWouldn't it be better if this field just created a new image node? Then we could have thumbnails, we could put the image into a gallery, etc.
I have tried: it's almost working, but still have issues (due to my poor coding).
Comment #6
Zach Harkey CreditAttribution: Zach Harkey commentedYES! That is exactly what we need!
The biggest problem with the current implementation is that it takes no advantage of the strengths of the built-in image module. Meaning:
As it is now, I don't even use the flexinode image fields for the above reasons. Instead, what I've been doing(and it is so backwards) is to create a flexinode textfield called "Image" where the user enters the nid of the image they want to enter. This requires them to upload the image separately as an image node, but it has all the benefits of being an image node previously stated. So when I theme the flexinode template node I control the display of the image (which is just a nid) like so:
This method is extremely easy to theme and maintain. The problem is that it still requires too much of my clients. At least they don't have to prepare the image for upload as much, but it still requires that they leave the current page and upload the image separately, then write down the node id from the URI in their browser(I love to make the client think about node id's when all they want to do is "add a picture"), and then come back into the flexinode form and enter the id number there.
It would be so slick if they could upload an image from within the flexinode form and have the image node automatically created and it's nid saved into the flexinode object. It would be completely seemless! The icing on the cake would be if the client could choose to upload a new image or choose from the existing images, which would open a kind of thumbnail gallery (like image_assist) but when they choose the image, it just saves the image's nid into the object.
Comment #7
Cvbge CreditAttribution: Cvbge commentedI agree that it'd be probably better to use image.module (but user comments are already available with flexinode, and the module can be fixed so it puts files into files/images dir).
For http://drupal.org/node/21979#comment-34697:
please submit a patch (instructions are somewhere on http://drupal.org/contribute).
Also, you should not use
t('An ') . l(t('image'), 'node/' . $node->$fieldname) . ' has been u ...
(strings concatenating), but use array method as used previously. Otherwise it's imposibile to translate it.Comment #8
Cvbge CreditAttribution: Cvbge commentedI could not test the first patch (http://drupal.org/files/issues/field_image.inc.patch) because I was getting "malformed line" or similar when trying to patch the file.
I've tested #5 patch (http://drupal.org/files/issues/field_image_0.inc). It still have some problems, but overall works nicely - thumbnail is generated, but when entering the posted node the thumbnail is still present. You need to click on the thumbnail to go to image node and the image is in 'preview' state. I'd like (as an option) the image to be in preview state when entering flexinode node.
[There's also the translation issue that need to be fixed]
Comment #9
Cvbge CreditAttribution: Cvbge commentedI'm also concerned about use of image.module internal functions, like _image_build_derivatives, they should be copy&pasted into flexinode or image.module should create some sort of API...
Comment #10
Cvbge CreditAttribution: Cvbge commentedSo here's my proposition.
Thumbnails are generated using GD now, not imagemagic.
They are displayed when node is displayed in teaser mode (front page, taxonomy term listing). Had to modify flexinode.module though, not sure if this won't break other fields... The change was small, please test.
I think I'll be able to provide an example of working module, but first I'll try to add preview mode, as stated in TODO:
in teaser mode we link to full node, and in full node the image becomes a link to original image (if enabled)
There's a problem that when editing a node saving it the thumbnail is regenerated even if no new image was uploaded.
Comment #11
Bèr Kessels CreditAttribution: Bèr Kessels commentedcuold yuo not use the image toolkits? hey offer very good functions, that aer installed anyway (sortof anyway)
Comment #12
Cvbge CreditAttribution: Cvbge commentedAbout my previous comment:
This is not true. There are no direct calls to GD functions. Image resizing is done using drupal's image_scale(), which AFAIK uses whatever image toolkit you have/choose.
Comment #13
Cvbge CreditAttribution: Cvbge commentedHere's updated patch that also generates image previews.
An example of this patch can be seen at http://graffiti.cvbge.org/
I think the patch still need changes, I'd like the original image to be available as a link below preview image, with resolution and size printed (original images can be very big).
BTW, there's a problem when using postgresql db and trying to add flexinode node:
Another bug is when I enabled cache:
Comment #14
Cvbge CreditAttribution: Cvbge commentedAnd here's a patch that prints "Get original file (xxxKB)" link below the image.
Comment #15
Cvbge CreditAttribution: Cvbge commentedLast patch went in (to HEAD for now), with two additional '@' before filesize().
The thumbnail regeneration issue is still not fixed, but it's should not break anything.
Comment #16
Damien Tournoud CreditAttribution: Damien Tournoud commentedI have several reasons to think that this should go to a separate module, not a part of flexinode.
As I understand it, flexinode manages content that have no special semantic : each fields you can define for a node have no special meaning. You can only use flexinode when the fields do not interact with each other, and do not require special processing.
The 'thumbnail' of a node have a special semantic : it's an image that represent the node, that can be shown as an icon in a node list, or as an illustration on a node page. This requires processing that image in a "special way", especially in themes. This is impossible using flexinode, because you cannot attach a special meaning to a field.
To make myself clear, I want to be able to associate an image to a node, that could be shown:
The best way to achive this is to use the "image" node type provided by image.module, that manages the generation of thumbnails of different sizes.
I already did some work to achive these goals.Is someone interested by that idea?
-- DamZ
Comment #17
Cvbge CreditAttribution: Cvbge commentedI can't agree with you. Flexinode already had a $teaser parameter which was used when displaying a field (although only in some cases; attached patch added this to most common case - when a node is displayed on main page or as a whole node). So there are already two different 'types' of display, and previously field_image had
if ($brief)
code.Also, themes can react to different types of display - teaser vs full node - using css and classess (probably the code need to be added, but I think it's possibile). I'm not a themer, so please correct me if I'm wrong.
I'd be interested :)
Comment #18
Zach Harkey CreditAttribution: Zach Harkey commented+1 This triples the value of this module.
Comment #19
Marandb CreditAttribution: Marandb commentedSorry if this is in the wrong area but I am having a problem getting the update "field_image.inc" to work.
Applying the new field_image.inc (from CVS) works on my test site but not on the live site. Everything is pretty much identical between them. I have even checked almost every file to be sure they are the same. (Exact same Flexinode file - with & without Fleximax applied)
The Test Site (WORKING)
http://www.minifigcustomizationnetwork.com/testsite/node/11
The Live Site (NOT WORKING)
http://www.minifigcustomizationnetwork.com/node/373
When submitting a flexinode with image on the Live site it gives about 45 warnings / errors refering to various lines in "includes/image.inc" file and one warning / error refering to line 192 in "includes/common.inc". (Both sites are using the same image.inc & common.inc versions)
I am very frustrated with this mainly because it works on one site & not the other. Almost everything is identical between the sites as far as I can see.
Does anyone know what this might be? Anyone run into something similar to this before?
Thanks in advance,
-- Marand Barrientez
Comment #20
Marandb CreditAttribution: Marandb commentedI did finally find the one difference between the sites. The live site has "Private Files" enabled and the test site does not. After disabling Private Files it seems to work.
Is there any way to fix this? I (and I am sure many here) would like to keep the Private Files feature enabled.
Thanks,
-- Marand B.
Comment #21
Cvbge CreditAttribution: Cvbge commentedHm looks like Private downloads won't work, because one function (hook_file_download()) is not implemented...
I'm looking at how hard would it be to make private downloads work.
Comment #22
Marandb CreditAttribution: Marandb commentedAnother very frustrating problem I have been running into is that on one type of flexinode in particular everytime I upload a jpg file the preview & thumbnail work properly, but when I "View Full Image" it returns:
The image “http://***.jpg” cannot be displayed, because it contains errors.
Has anyone else run into this problem? This does not happen on every image uploaded. Some work & some don't. :S
Also, there is an issue with one image field uploading the files ok, creating the preview & thumbnails ok then when you "View Full Image" the image size is not the full image, but that of the preview.
Any ideas?
Also, any progress with the private files issue?
Thanks,
Marand B.
Comment #23
Marandb CreditAttribution: Marandb commentedOk, I found out the solution to the problem I was having with the the images not showing up and saying "The image “http://***.jpg” cannot be displayed, because it contains errors." The problem was that the uploaded image was exported as CMYK. I changed the color model to RGB & it worked. (Yippie)
Now, I am still having an issue with one flexinode field reducing the size of the full size image to the preview image dimensions. Any ideas.
Thanks,
Marand B.
Comment #24
thinkinkless CreditAttribution: thinkinkless commentedTHANK YOU!!!!
field_image.inc.patch ...has made me very happy.
Flexinode obviously can stand a ton of improvement with image handling but this at least implements the intended functionality and solved a huge problem for me. I can get my flexinode themes working with proper teasers now e.g.:
Comment #25
RobRoy CreditAttribution: RobRoy commentedI'm still having the private files issue with Flexinode. I have private files turned on and the filepath being returned with each flexinode image field object is still the non-accessible web directory. Any thoughts on how to convert this to actually access that file?
Comment #26
RobRoy CreditAttribution: RobRoy commentedFor anyone who's trying to get images to display with private files turned on...try using file_create_url() to get the private file path.
i.e.
print file_create_url($node->flexinode_2->filepath) " />
Comment #27
fax8 CreditAttribution: fax8 commentedthe attached patch fix a broken link.
The problem is a conseguence of the removing of the base tag.
Comment #28
RobRoy CreditAttribution: RobRoy commentedI applied the patch but I got tons of errors when trying to upload an image now.
I'm using private files mode on 4.6 and applied the patch from CVS ver 1.17. On saving I get
Comment #29
RobRoy CreditAttribution: RobRoy commentedOkay, that error above was for not putting sizes as 100x80. My fault, but we still need some validation in there.
This patch makes it work for private file access. The patch is against 4-6 CVS I think. ;) This is awesome, makes flexinode great. It could still use some cleaning up I'm sure, but it's functional for private file access now.
Comment #30
Bèr Kessels CreditAttribution: Bèr Kessels commentedLet us focus on the proposed feature.
We want thumbnail functionality in the image.inc. Nothing more nothing less. No private fields etc.
I want to see a new patch, updated for either 4.7 or 4.6 so that we can review. Please do not add any other features in. And do not provide a patch with all sorts of FIXMEs in them.
If I get a new patch, and a positive review and test, I will commit. If I get a proper patch, but no review, I will review myself.
Bèr
Comment #31
rwohleb@techsanctuary.com CreditAttribution: rwohleb@techsanctuary.com commentedI haven't tried any but the original patch, but the original definately has a few problems. First, it doesn't use the 'l' function, which breaks sites not using clean urls. Additionally, $brief is only set in the table view. This means the original image is displayed in teasers.
I'm looking at the image field so I can use flexinode with the ecommerce module. I just want an ecommerce enabled node with flexible fields. The trouble with the current image field, even with patch, is that it still shows the field title. If flexinode gave the option of hiding specific field names, it would allow much more flexibility. I'm working on a patch with this in mind.
Comment #32
DeVill-1 CreditAttribution: DeVill-1 commentedI would like to try the patches listed above, but first I need to know which of these is the better version so that I know which one I should patch to:
field_image.inc,v 1.15.4.1 2005/04/16 12:56:10 JonBob
or
field_image.inc,v 1.16 2005/04/16 12:54:16 JonBob
What's confusing me with those is that one has a higher version number (I'm guessing v 1.16 is a version number), but the other was submitted last (although only by 2 minutes).
I just uploaded the Flexinode module a few days ago to my Drupal 4.6.6, and it came with the field_image.inc,v 1.15.4.1 2005/04/16 12:56:10 JonBob.
Can somebody tell me which of those 2 is better?
Comment #33
Damien Tournoud CreditAttribution: Damien Tournoud commentedClosing this old issue.