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

zhgenti’s picture

StatusFileSize
new13.62 KB

Here 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.

zhgenti’s picture

StatusFileSize
new12.93 KB

IDE has failed to format chained call of methods for dynamic queries, so here is another patch.

zhgenti’s picture

In 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

atlea’s picture

Subscribe

ludo.r’s picture

These errors are still there with latest version 7.x-1.1

joetsuihk’s picture

not 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.

Pierco’s picture

#2 works for me (applied on 7.x.2.0 not 7.x-1.1)

joetsuihk’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

@Pierco

Thanks for the info. But we do not commit patch to stable version. Can you test against 2.x-dev?

Pierco’s picture

It looks like the patch has already been applied on 2.x-dev: #1225254

zeit_geist’s picture

Applied 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.

joetsuihk’s picture

Status: Needs review » Fixed

#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!

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