I really like the "Automatically reuse cropped style" effect. It seems to load the first crop selection that was applied to an image. It would be nice if one could set a priority for the available crop selections so that a preferred crop selection could automatically be loaded and applied. Are there any plans to include this feature?

Comments

matthijs’s picture

Assigned: Unassigned » matthijs

That looks like a nice feature indeed, I'll try to implement it in a future release.

Matthijs

matthijs’s picture

Issue summary: View changes
Status: Active » Fixed

Hi,

I just added this feature, please give it a test drive and let me know if you have any issues!

Matthijs

morenstrat’s picture

Thank you! But it doesn't work for me...

I get the follwing notices/warnings when I add the "Manual Crop: Automatically reuse cropped style" effect:

  • Notice: Undefined index: style_priority in manualcrop_auto_reuse_form() (line 299 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: array_fill_keys() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form() (line 299 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: array_merge(): Argument #1 is not an array in manualcrop_auto_reuse_form() (line 299 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: array_filter() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form() (line 300 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Notice: Undefined index: style_priority in manualcrop_auto_reuse_form() (line 303 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: Invalid argument supplied for foreach() in manualcrop_auto_reuse_form() (line 304 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
matthijs’s picture

I've added an update hook to add the missing setting (which is causing this when you load the form for the first time), please run it and try again.

morenstrat’s picture

I'm still getting warnings and notices, and the only form item I see it the "Fallback image style" drow down. The priority table only has a header row.

  • Warning: array_fill_keys() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form() (line 299 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: array_merge(): Argument #1 is not an array in manualcrop_auto_reuse_form() (line 299 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: array_filter() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form() (line 300 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: Invalid argument supplied for foreach() in manualcrop_auto_reuse_form() (line 304 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: asort() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form_submit() (line 358 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
  • Warning: array_keys() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form_submit() (line 359 of /var/www/htdocs/sites/all/modules/manualcrop/manualcrop.admin.inc).
matthijs’s picture

That's weird.. Just to be sure: did you run update 7106? If this is the case I probably made a mistake in that update...

morenstrat’s picture

Yes, I ran the update. This is the serialized data for the manualcrop_auto_reuse effect in the image_effects table after the update:

a:2:{s:14:"fallback_style";s:7:"default";s:14:"style_priority";a:0:{}}
matthijs’s picture

Status: Fixed » Needs work

The data looks okay to me, so I probably missed something else... Stand by for a proper solution :-)

morenstrat’s picture

Oh, now it's working!

What I did: version 7.x-1.4+74-dev was installed. I installed the git version and it didn't work (comment #3). Reverted to 7.x-1.4+74-dev, then git version again and ran update 7106, but it didn't work (comment #5). Reverted to 7.x-1.4+74-dev, manually reverted schema version in system table to 7105. Installed git version again, ran update 7106 and.. it worked!

matthijs’s picture

Status: Needs work » Fixed

Very weird, but I'm glad it's working now... Maybe you were experiencing some kind of caching glitch?
I'll try to give the update some more test drives just to be sure. Thanks for your help/time!

morenstrat’s picture

Must have been caching... I checked my .bash_history to verify that I ran update 7106 the first time, and I did...

Thank you for your efforts!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jesss’s picture

Status: Closed (fixed) » Needs work

I just ran into this issue with a fresh install of 7-x-1.x-dev (installed yesterday, January 21). Following the experience of dunix, I manually reset the schema version to 7105 and ran updb, but no joy.

kars-t’s picture

In the latest dev I am as well missing a list of automatic fallbacks.

Warning: array_fill_keys() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form() (line 299 of manualcrop.admin.inc).
Warning: array_merge(): Argument #1 is not an array in manualcrop_auto_reuse_form() (line 299 of manualcrop.admin.inc).
Warning: array_filter() expects parameter 1 to be array, null given in manualcrop_auto_reuse_form() (line 300 of manualcrop.admin.inc).
Warning: Invalid argument supplied for foreach() in manualcrop_auto_reuse_form() (line 304 of manualcrop.admin.inc).

$data seems to be all empty starting with the style being loaded by the menu callback. In my debugger I can see that this seems to be common to all styles but I have no clue where the $data array should be filled with settings.

capellic’s picture

I'm having the same problem as reported in comment #14. I am using the Dev version because of case #2070521: Images with Manual Crop style cannot be inserted into text area with Insert module. Thank you.

Warning: Invalid argument supplied for foreach() in manualcrop_auto_reuse_form() (line 304 of /mnt/www/html/survivalgiftsdev/docroot/sites/all/modules/contrib/manualcrop/manualcrop.admin.inc). 

Backtrace:
manualcrop_auto_reuse_form(Array) 
call_user_func('manualcrop_auto_reuse_form', Array) image.admin.inc:411
image_effect_form(Array, Array, Array, Array) 
call_user_func_array('image_effect_form', Array) form.inc:806
drupal_retrieve_form('image_effect_form', Array) form.inc:345
drupal_build_form('image_effect_form', Array) form.inc:131
drupal_get_form('image_effect_form', Array, Array) 
call_user_func_array('drupal_get_form', Array) menu.inc:517
menu_execute_active_handler() index.php:21

  • Matthijs committed e98578e on 7.x-1.x
    Issue #2092911: Fixed undefined styles_priority index when adding effect...
matthijs’s picture

Status: Needs work » Fixed

This is embarrassing, but I (probably) never checked adding a new reuse effect...
The errors should be gone now! Sorry and thanks for the feedback!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

candelas’s picture

I was having this issue with 7.x-1.4 and I can confirm that the bug goes away. Thanks :)