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.
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..
Comment | File | Size | Author |
---|---|---|---|
#34 | filefield_sources_compatiblity-495210-34.patch | 3.47 KB | daveparrish |
#33 | filefield_sources_compatiblity-495210-33.patch | 3.02 KB | daveparrish |
#32 | added._filefield_sources_widgets.function-495210-32.patch | 556 bytes | firfin |
yh.patch | 583 bytes | yhager |
Comments
Comment #1
Deciphered CreditAttribution: Deciphered commentedHi,
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.
Comment #2
quicksketchMy 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.
Comment #3
karljohann CreditAttribution: karljohann commentedWell it sure worked for me. Thanks.
Comment #4
akaserer CreditAttribution: akaserer commentedit works - great job
Comment #5
Alan D. CreditAttribution: Alan D. commentedIt 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
Comment #6
robbertnl CreditAttribution: robbertnl commentedExcellent! It works!
A suggestion: a setting for enabling and disabling Upload / filebrowser / reference existing / remote url
Comment #7
yhager CreditAttribution: yhager commentedI'd like to continue tracking this in imagefield_crop issue queue
Comment #8
benone CreditAttribution: benone commentedis 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 ?
Comment #9
benone CreditAttribution: benone commentedoh, and I am using filefield_paths also.
Comment #10
YK85 CreditAttribution: YK85 commentedsubscribing
Comment #11
robbertnl CreditAttribution: robbertnl commented#8: Did you choose the crop widget for your filefield?
Comment #12
akaserer CreditAttribution: akaserer commentedthe 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?
Comment #13
akaserer CreditAttribution: akaserer commentedi guess changing
to
should solve the case
thanks
Comment #14
akaserer CreditAttribution: akaserer commentedcould somebody reconfirm and if its ok, commit?
Comment #15
yhager CreditAttribution: yhager commented@akaserer: The correct solution to this is to use the new alter hooks implemented now in CCK.
Comment #16
robbertnl CreditAttribution: robbertnl commentedI can confirm #13 works for the newest release, thank you
Comment #17
lolmaus CreditAttribution: lolmaus commentedSubscribing
Comment #18
pixelsweatshop CreditAttribution: pixelsweatshop commentedSub
Comment #19
Fidelix CreditAttribution: Fidelix commentedSuãwbiscruiaibingg
Comment #20
porg CreditAttribution: porg commentedSubscribing.
Comment #21
John Pitcairn CreditAttribution: John Pitcairn commentedsub
Comment #22
perandre CreditAttribution: perandre commentedIt's been a while since this patch was made; are there currently any new efforts to make imagefield_sources support sources?
Comment #23
yhager CreditAttribution: yhager commentedThis 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.
Comment #24
botrisSkip patch, use #13 works fine in D6
Comment #25
daveparrish CreditAttribution: daveparrish commentedWhy not add the hook in Imagefield Crop? That worked fine for me:
Comment #26
Eugene Fidelin CreditAttribution: Eugene Fidelin commented#25 works for me
Comment #27
juroon CreditAttribution: juroon commented#25 worked for me too. Simple solution to a longstanding problem.
Thanks!
Comment #28
Fidelix CreditAttribution: Fidelix commentedWhat about D7? Any efforts on making this patch work with it?
Comment #29
Greg Varga CreditAttribution: Greg Varga commented-
Comment #30
yhager CreditAttribution: yhager commentedpatches are welcome
Comment #31
mediamash CreditAttribution: mediamash commentedshould add this to code, works like a charm
Comment #32
firfin CreditAttribution: firfin commentedAs 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.
Comment #33
daveparrish CreditAttribution: daveparrish commentedFor 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]
Comment #34
daveparrish CreditAttribution: daveparrish commentedI fixed the D7 patch so that filefield_sources no longer needs to be patched for imagefield_crop to work with filefield_sources.
Comment #35
ShaneOnABike CreditAttribution: ShaneOnABike commentedRe: #32 thanks for rolling that it works for me. Can we push this into the module pleaszzz. Then peeps can test the D7 version and push that through.
Comment #36
firfin CreditAttribution: firfin commentedComment #37
joetsuihk CreditAttribution: joetsuihk commentedThank you everyone. Committed to 7.x-1.x
http://drupalcode.org/project/imagefield_crop.git/commit/a2c696a
If anyone review #32, I can commit to 6.x branch also. Change issue status as stated.
Comment #38
d.sibaud CreditAttribution: d.sibaud commentedthe following part of the patch was lost somewhere in the process so the dev branch 7.x-1.x does not works, putting it back let it works again: