Upgraded to 1.1 and now i get this error when editing a node with a cropped image field.

Warning: imagecopyresampled() expects parameter 5 to be long, string given in image_gd_crop() (line 190 of /home/admin/public_html/mit/modules/system/image.gd.inc).

disabling the module and the errors go away

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jay-dee-ess’s picture

Getting this w/ 1.1 and 1.1-dev

joetsuihk’s picture

Status: Active » Postponed (maintainer needs more info)

Need more info. Cannot reproduce on ubuntu 12.04 gd2 imagefield_crop 1.x-dev

Suspect something around imagefield_crop.module line 513 image_crop(), which invoke
http://api.drupal.org/api/drupal/modules%21system%21image.gd.inc/functio...

Can you check your $crop['x']? Need to change to int manually?

miik4’s picture

Regarding this version I get the exact same message when saving a node which contains image that is using image field crop.
And this error comes when node is saved when the cropping tool wasn't showing up.
Meaning when I edit a node, I only see the image (and the image is shown from upper left corner to defined size NOT from earlier set cropping area)

When I hit refresh in node/##/edit the system does load the cropping tool (sometimes hit refresh twice), then I can do editing and save without errors.

Very confusing, because sometimes the cropping tool shows instantly.
And I don't think this is a browser issue, tested with Firefox, Safari & Chrome - same behavior (and console gives no errors).

I can live with this now, though it's annoying to tell clients/colleagues/people that you have to hit referesh furiously if the tool isn't showing :)

I got the same thing with dev-version => have to dig out more with this issue.

Edit:
Okay I was using image field in vertical tab group. If the group isn't first (=active when node/##/edit loads) then crop tool might not be there.
Moved Images group to first and voilà \o/

jnettik’s picture

I am getting this same error:

  Warning: imagecopyresampled() expects parameter 5 to be long, string given in image_gd_crop() (line 190 of /modules/system/image.gd.inc).

with and additional PDO and log error of:

  Image crop failed using the gd toolkit on public://headshots/amardesai.jpg (image/jpeg, 168x160)

For me I think it had to do with my image. The image being uploaded was 2px smaller in width than my crop was set to. When I scaled the image up and tried agan, there were no errors.

very_random_man’s picture

I'm getting this error too. It seems to be conflicting with the Field Group module. If I put image fields with cropping inside of a field group, it makes the error. Outside the group and it works just fine.

jnettik’s picture

That makes sense. I was using Field Groups when I was using this module/

DesTincT’s picture

try to add a little code here

imagefield_crop.module

function imagefield_crop_widget_process($element, &$form_state, $form) {
//...
// (somewhere 220 line)
    $size = getimagesize(file_create_url($file_to_crop->uri)); //new

    $element['cropbox'] = array(
      '#markup' => theme('image', array(
          'path' => $file_to_crop->uri,
          'attributes' => array(
		  	'width' => $size[0], //new
			'height' => $size[1], //new
            'class' => 'cropbox',
            'id' => $element['#id'] . '-cropbox'))),
    );
//...
}

added width and height to .cropbox image element to make js work

realityloop’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs review
FileSize
797 bytes

Patch attached