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.
I use the same image in both our main web-theme, and in our mobile-theme. The latter needs a smaller height-width of the image.
That's why we use two different presets. One crops to 540 pixels width, and one that crops to 200 pixels width.
With imagecrop today I need to make the crop twice, for both of my presets.
Would it be possible to crop two different presets simultaneously?
Comment | File | Size | Author |
---|---|---|---|
#20 | Select_existing_img.jpg | 11.04 KB | Alx |
#20 | Before_Crop.jpg | 40.16 KB | Alx |
#19 | Select_existing_img.jpg | 11.04 KB | Alx |
#19 | Before_Crop.jpg | 40.16 KB | Alx |
#10 | imagecrop-743782-10.patch | 2.32 KB | olrandir |
Comments
Comment #1
gooddesignusa CreditAttribution: gooddesignusa commentedI had a similar problem. On the full view of a node the image would be cropped. In teaser view I wanted to make a thumbnail of the cropped image. I didn't want to have to make them crop the image twice. I basically cheated and did a search and replace and manually ran the cropped image through another preset. I'm sure there is a better way to do it but i'm not a drupal pro and this got the job done. The first line was needed to strip out the image height and width. If I didn't strip them out the image would be smaller but stretched. Second line just replaces part of the location of the image with another location.
I used this on a views template file. example: views-view-field--field-story-img-fid.tpl.php
Hopefully my post helps you look @ the problem from another angle.
I would love a check box that said use same crop region for this preset or something like that. But in the mean time this works.
Comment #2
espenmoe CreditAttribution: espenmoe commentedthx!
Comment #3
tacituseu CreditAttribution: tacituseu commentedAdds action 'Javascript crop reuse selection', Tested with imagecache 6.x-2.0-beta10 and current dev of imagecrop.
Comment #4
tacituseu CreditAttribution: tacituseu commentedComment #5
gynekolog CreditAttribution: gynekolog commentedtacituseu: working but only for one another preset
Comment #6
tacituseu CreditAttribution: tacituseu commentedNot sure what you mean by that, is there no way to select other presets in 'Javascript crop reuse selection' action's configuration ? All presets containing 'Javascript crop' action should show up there.
Comment #7
gynekolog CreditAttribution: gynekolog commentedExcuse me, my english is terrible. I have 'Javascript crop reuse selection' on another one preset, all is ok. But when i use it on another next preset, function stop working and all preset with 'Javascript crop reuse selection' are like without this function
Comment #8
Wolfgang Reszel CreditAttribution: Wolfgang Reszel commentedWe need it for D7, too.
Comment #9
olrandir CreditAttribution: olrandir commentedI'd love to be able to do this in D7 as well. Subscribing.
Comment #10
olrandir CreditAttribution: olrandir commentedWorking on transferring the image style re-use functionality to D7, so far I've only copied what the D6 patch does into the D7 module file. I'm stuck on the "imagecache_preset_by_name" function, which does not seem to be available for D7. What should I use in its stead? I'm a relative newbie (only worked with drupal for 2 months), so any help is appreciated!
Attaching patch which DOES NOT WORK, only produces "Call to undefined function" error when calling the aforementioned function.
edit: also, setting git up to create a patch that way proved too time-consuming for me to do right now, so for the time being the attached patch is created with "diff -up".
Comment #11
tacituseu CreditAttribution: tacituseu commentedHave a look at
canvasactions_aspect_image()
from imagecache_actions-7.x-1.x-dev.tar.gz for some clues.Comment #12
dddbbb CreditAttribution: dddbbb commentedSubscribing. +1 for a D7 version.
Comment #13
JonasMikkelsen CreditAttribution: JonasMikkelsen commentedSubscribing. Also need the D7 version.
Comment #14
nils.destoop CreditAttribution: nils.destoop commentedCurrently looking to add the patch from #10 to current dev. Thx olrandir :)
I will also add the patch for d6 version.
Comment #15
nils.destoop CreditAttribution: nils.destoop commentedRe-use crop selection is now working in 7.x.dev
Comment #16
olrandir CreditAttribution: olrandir commentedTested on D7.2 and works nicely, thanks!
One comment: the re-used image style doesn't change when the original image style changes. That is, if we have a crop style called big_gallery and a style called small_gallery that re-uses the previous style (and, say, scales it to something smaller), re-cropping the big_gallery style won't change the small_gallery once it's been rendered.
This also means that if you set your content type to display the small_gallery style (which means it will be rendered immediately upon upload), it will use the default crop, and not the user-selected crop settings that will be applied *after* the upload. Clicking "update style" in the image style configuration page will create the correct image style.
Comment #17
Alx CreditAttribution: Alx commentedI try several times on D7.4 but its not working for me.
In image styles I create new style "recrop" and add effect "Reuse a javascript crop selection" but when I need in content to choose "Available imagecrop styles" there are no "recrop" effect to choose.
Do I need first add "Javascript crop" effect and then "Reuse a javascript crop selection" in "recrop" or "Reuse a javascript crop selection" work as alone effect.
Or maybe I do something wrong..
I need this multiple crop (re-use crop) for one newspaper publisher project where from one scan page I need to make multiple article crops.
I need help ASAP only this solution wait me to finish web portal.
Thanks in advance to everyone who can help me.
Comment #18
olrandir CreditAttribution: olrandir commentedFirst create an image style for the original crop, then create an image style and select re-use image crop. In the settings for that effect, select the original crop style you created. Then add any other effect you want.
Comment #19
Alx CreditAttribution: Alx commentedAt first thank you olrandir for suggestion how to use "Reuse a javascript crop selection".
Today I have another problem when I am using "Javascript crop" with >>Add a new file with Reference existing<< its not posible to use second time same image to crop. If you crop second time it will be change also on first time using image crop.
When I need this to use...
First with some content I upload newspaper pages.. (lets say 20 pages)
Then I add content page where I need to crop articles. With >>Add a new file with Reference existing<< I find page from newspaper (lets say page No. 6) and use some "Javascript crop" style.
Then I add another content page where with >>Add a new file with Reference existing<< I open same newspaper page (page No. 6) and I want to use another crop. When I make second crop in another content with same newspaper page I loose parameters from another crop of that pages (mean now first content page have same parameters of crop from second content page).
At the end.
At this moment with this module its not possible to make more than one crops when you are using AUTOCOMPLETE REFERENCE OPTIONS to select same image more than once.
I need some another advice how I can make this I with this or some other module.
If you need more informtions which can help you I will be glad to support to make this module better.
Thans in advance for any other suggestion or solution for croping more than once from one image.
Comment #20
Alx CreditAttribution: Alx commentedPOSTED IN NEW ISSUE!
Re-crop (multicrop) from same image select with AUTOCOMPLETE REFERENCE OPTIONS
(Maybe I need this to put in another issue)
Thanks
Comment #21
Alx CreditAttribution: Alx commentedComment #22
nils.destoop CreditAttribution: nils.destoop commentedComment #23
nils.destoop CreditAttribution: nils.destoop commentedThis is now also in D6 dev version