Posted by yhager on June 18, 2009 at 12:52pm
20 followers
| Project: | Imagefield Crop |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | firfin |
| Status: | needs review |
Issue Summary
Folllowing #490470: Doesn't play nice with filefield_insert I prepared a patch to support imagefield_crop from within filefield_sources.
However, I am not sure if this is the right way to implement this. Since imagefield_crop actually MODIFIES the original file (in case of file reference). Maybe the correct implementation would be to actually clone the file object and crop that instead?
Let me know what do you think..
| Attachment | Size |
|---|---|
| yh.patch | 583 bytes |
Comments
#1
Hi,
I think it would make more sense to have a hook_filefield_sources_support() or something similar so other modules can be supported without the need of making a change to FileField Sources.
But this is just my opinion.
Cheers,
Deciphered.
#2
My long-term hope actually has been that modules like ImageField Crop *extend* the existing Image widget in the same way that FileField Sources extends FileField. But that's all dependent on #417122: Allow drupal_alter() on Field and Widget Settings, so that modules can extend a widget without actually creating a new one entirely.
RE: "Maybe the correct implementation would be to actually clone the file object and crop that instead?".
That sounds like a safer approach generally. Actually it might be interesting to make ImageField Crop *always* maintain the original image (enabling a functionality like "recrop" after the original save). This would require ImageField Crop to store extra data though... which makes things a bit more difficult.
#3
Well it sure worked for me. Thanks.
#4
it works - great job
#5
It would be best having something more generic like #541220: Allow custom filefield widgets to use filefield sources to prevent the need to have this module patched every time a new widget comes out for FileField
#6
Excellent! It works!
A suggestion: a setting for enabling and disabling Upload / filebrowser / reference existing / remote url
#7
I'd like to continue tracking this in imagefield_crop issue queue
#8
is this patch really working for you guys ?
crop is working ?
when I save crop is not working, then I need to edit node, and save again. and then crop is working. what can be wrong ?
#9
oh, and I am using filefield_paths also.
#10
subscribing
#11
#8: Did you choose the crop widget for your filefield?
#12
the patch in this post worked.
but seems that a patch from
http://drupal.org/node/436174
was commited.
the function
function filefield_sources_elements()
was completely changed.
does anybody know how to implement the function?
#13
i guess changing
function filefield_sources_filefield_sources_widgets() {return array('filefield_widget', 'imagefield_widget');
}
to
function filefield_sources_filefield_sources_widgets() {return array('filefield_widget', 'imagefield_widget', 'imagefield_crop_widget');
}
should solve the case
thanks
#14
could somebody reconfirm and if its ok, commit?
#15
@akaserer: The correct solution to this is to use the new alter hooks implemented now in CCK.
#16
I can confirm #13 works for the newest release, thank you
#17
Subscribing
#18
Sub
#19
Suãwbiscruiaibingg
#20
Subscribing.
#21
sub
#22
It's been a while since this patch was made; are there currently any new efforts to make imagefield_sources support sources?
#23
This patch cannot be used as it is, it needs to be rethinked.
Anyway, all of my (very little) time goes now to making a D7 release of imagefield_crop.
#24
Skip patch, use #13 works fine in D6
#25
Why not add the hook in Imagefield Crop? That worked fine for me:
/*** Implements hook_filefield_sources_widgets().
*
* This returns a list of widgets that are compatible with FileField Sources.
*/
function imagefield_crop_filefield_sources_widgets() {
return array('imagefield_crop_widget');
}
#26
#25 works for me
#27
#25 worked for me too. Simple solution to a longstanding problem.
Thanks!
#28
What about D7? Any efforts on making this patch work with it?
#29
-
#30
patches are welcome
#31
should add this to code, works like a charm
#32
As requested in #30 this patch contains the extra function from #25.
It is a patch against the 6.x-1.x branch.
The function itself is pretty well tested I think, if someone else could also apply it to see if it works (it does on my install.)
If this is gonna be committed, I will also write a patch for the readme.txt / documentation. The potential danger of cropping images already on server should be clarified.
#33
For those who are looking for a Drupal 7 patch. I've attached a patch which works on imagefield_crop-1.x-dev. I also made a patch and issue for filefield_sources which has a necessary change in order to get these two modules to work together.
The problem I experienced was, when I used imagefield_crop with filefield_sources, the sources select on the widget would not change the form options. So, if I clicked "Remote URL" nothing would happen. This is filefield_sources functionality but the fix was to modify the imagefield_crop HTML so that it was compatible to what filefield_sources is expecting.
The filefield_sources patch fixes and issue where the transfer URL wouldn't work. The filefield_sources issue is here:
#1414958: Filefield_sources not compatible with imagefield_crop [PATCH]
#34
I fixed the D7 patch so that filefield_sources no longer needs to be patched for imagefield_crop to work with filefield_sources.