When there is no need to scale the image and you want just to cut some part of it, I set "The resolution to crop the image onto" values to 0 and widget shows a list of errors, related to undefined variables.
when saving widget settings:
Notice: Uninitialized string offset: 0 in _imagefield_crop_widget_enforce_ratio_validate() (line 130 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Uninitialized string offset: 0 in _imagefield_crop_widget_enforce_minimum_validate() (line 137 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Uninitialized string offset: 0 in _imagefield_crop_widget_enforce_minimum_validate() (line 138 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
And when uploading an image:
Notice: Undefined offset: 1 in imagefield_crop_widget_process() (line 221 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: width in imagefield_crop_widget_preview_process() (line 297 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: height in imagefield_crop_widget_preview_process() (line 298 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: width in imagefield_crop_widget_preview_process() (line 310 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: height in imagefield_crop_widget_preview_process() (line 311 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined offset: 1 in imagefield_crop_widget_process() (line 221 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: width in imagefield_crop_widget_preview_process() (line 297 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: height in imagefield_crop_widget_preview_process() (line 298 ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: width in imagefield_crop_widget_preview_process() (line 310 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Notice: Undefined variable: height in imagefield_crop_widget_preview_process() (line 311 of ..\sites\all\modules\imagefield_crop\imagefield_crop.module).
Comments
Comment #1
zhgenti commentedHere is a patch, which adds validation for undefined values, corrects formatting issues according to coding standards, adds small fix to js file(required to fix setting default crop area, which stopped working after adding closing tag for div http://drupal.org/node/1111898). Also preview area is hidden, when image shouldn't be scaled.
Comment #2
zhgenti commentedIDE has failed to format chained call of methods for dynamic queries, so here is another patch.
Comment #3
zhgenti commentedIn the other issue i've posted another patch which contains all changes from #2. That patch allows to set relative ratio like 4:3 for crop area. http://drupal.org/node/1106924#comment-4400186
Comment #4
atlea commentedSubscribe
Comment #5
ludo.rThese errors are still there with latest version 7.x-1.1
Comment #6
joetsuihk commentednot surprise 7.x-1.1 had not fixed this, because this is "needs review". Please report if #2 works well after applying on 7.x-1.x.
Comment #7
Pierco commented#2 works for me (applied on 7.x.2.0 not 7.x-1.1)
Comment #8
joetsuihk commented@Pierco
Thanks for the info. But we do not commit patch to stable version. Can you test against 2.x-dev?
Comment #9
Pierco commentedIt looks like the patch has already been applied on 2.x-dev: #1225254
Comment #10
zeit_geist commentedApplied on 7.x-1.1 doesn't work.
Errors when filled with 0:
Width and height must be filled out in The resolution to crop the image onto field
Target resolution must be defined as WIDTH_HEIGHT if minimum is to be enforced.
Errors when leaved blank:
Width and height must be integers
Target resolution must be defined as WIDTH_HEIGHT if minimum is to be enforced.
Comment #11
joetsuihk commented#9 Pierco is correct. Patch #2 already committed on 2.x #1225254: 7.x-2.0 version
For 1.x, please look at #2090141: PHP notices if output resolution is not set
Mark as fixed. Thanks all!