Hi,

I installed ImageAPI 1.6 and got the following error message:

* warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 243.
* warning: imagecolorallocate(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 267.
* warning: imagefill(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 267.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 126.

I upgraded to the latest 1.x-dev from 2009-Apr-18 but nothing changed.

I don't know what's wrong. I have a clean installation :: Drupal 6.10, MySQL 5, PHP 5.2.8.
Related modules:
ImageCache :: 6.x-2.0-beta9
Imagecache Profile Pictures :: 6.x-1.0

I also found this issue: #431422: Syntax error in imageapi_gd.module
I was not sure this is the same problem, so I create a new issue.

Thank you in advance.

Stefan

CommentFileSizeAuthor
#6 Picture 5.png123.48 KBBassPlaya
#2 ImageAPI_modules.png251.42 KBdesign.er
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drewish’s picture

Status: Active » Postponed (maintainer needs more info)

what module is using imageapi? imagecache? does this occur with every image on your site or just one?

if it's just one you've probably got an image that isn't compatible with gd. otherwise i need more detail on what's calling imageapi.

design.er’s picture

FileSize
251.42 KB

Thanks for your help.

Attached is a screenshot of all my modules. Primary I use the image modules for profile avaters. When uploading a user picture I get the following error:

* warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 243.
* warning: imagecolorallocate(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 267.
* warning: imagefill(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 267.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\mysite.com\sites\all\modules\imageapi\imageapi_gd.module on line 126.

The next strange thing is that when I create/edit/delete imagecache actions, I sometimes get the following error:

* warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 243.
 * warning: imagealphablending(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 260.
 * warning: imagecolorallocatealpha(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 261.
* warning: imagefill(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 262.
* warning: imagealphablending(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 263.
* warning: imagesavealpha(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 264.
* warning: imagecopyresampled(): supplied argument is not a valid Image resource in D:\DEVELOPMENT\xampp\www\support-plattform\sites\all\modules\imageapi\imageapi_gd.module on line 126.

I can't find any routine/logic there because this error appears by far not every time although I reproduce the same actions in different imagecache presets.

The worst thing is that i.e. the preset "avater_profile" don't save any pictures in the preset folder, so I never see a picture on profiles.

The strangest is, I use the same image modules together on other sites without any problems. I tried 2 absolutely clean installations with the same result.

Regards,
Stefan

drewish’s picture

oh, i meant a copy of the image you're uploading. it wasn't an animated gif file was it?

design.er’s picture

No, it's a normal jpg image. I use this also on Facebook and Drupal sites where ImageAPI, ImageCache etc. are installed in the same combination and the same versions.
I can upload this image and send a download link via contact form.

Please let me know if you need more information, exports etc.

Is it possible that one of the non-image modules force this errors? ...such as Advanced Forum or Author Pane? I never worked with this modules before. But I think no similiar issues happend up to now, right?

design.er’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I think we can close this issue. On Drupal 6.11 the mentioned bugs never appeared.

drewish, thanks a lot for your help! :)

Best regards
Stefan

BassPlaya’s picture

Status: Closed (fixed) » Active
FileSize
123.48 KB

I have the same problem on Drupal 6.13.
Why is this closed? And what's the solution to this.. I've been reading many similar posts and I'm not using this for the profile avatar but just for uploading a simple image with imagecache, imageapi and cck?
It would be great if someone "who knows the answer" could drop a post about this so that similar users are not spending so much time on effortless searching for the problem..

@design.er: what did you learn from this? What holds you back sharing your solution with us?

Thanx maintainer.

Squidgy’s picture

Version: 6.x-1.6 » 5.x-1.5

I'm experiencing this same issue, running the 5.x-2.5 version of ImageAPI. Images aren't being generated, and I'm not sure why. #6 - Is your environment IIS as well?

The environment is:
IIS 7
PHP 5.2.10

The errors I'm seeing are:
* warning: imagesx(): 80 is not a valid Image resource in C:\inetpub\wwwroot\clients.bpiw.ca\envision\sites\all\modules\imagecache_actions\watermark.inc on line 25.
* warning: imagesy(): 80 is not a valid Image resource in C:\inetpub\wwwroot\clients.bpiw.ca\envision\sites\all\modules\imagecache_actions\watermark.inc on line 26.
* warning: imagejpeg(): 80 is not a valid Image resource in C:\inetpub\wwwroot\clients.bpiw.ca\envision\sites\all\modules\imageapi\imageapi_gd.module on line 70.

Debugging it, I saw that imageapi_image_open never gets an $image->resource, so I called imageapi_gd_image_open($image); to make sure it did - but it still believes the image resource to be invalid somehow. I can run gd commands on that resource, but it just will not generate anything.

...what's odd is that I'm also running Imagecache 1.x on this same server, which still renders images just fine.

BassPlaya’s picture

I had it fixed by uninstalling the imagecache and image api module from the uninstall page. Clear the caches, via Drupal and in the database. Then reinstall everything.. problem resolved. I can't tell what caused this problem.

s.Daniel’s picture

Version: 5.x-1.5 » 6.x-1.6

Had the same error. Tryed uninstalling, reinstalling, flushing caches, checking chmod/chown and couln't get images to show up in views (except for the original) and now after repeating the steps mentioned above it sudenly works. No clue what could've caused the error.

After editing a preset:

    * warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 243.
    * warning: imagealphablending(): supplied argument is not a valid Image resource in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 260.
    * warning: imagecolorallocatealpha(): supplied argument is not a valid Image resource in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 261.
    * warning: imagefill(): supplied argument is not a valid Image resource in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 262.
    * warning: imagealphablending(): supplied argument is not a valid Image resource in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 263.
    * warning: imagesavealpha(): supplied argument is not a valid Image resource in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 264.
    * warning: imagecopyresampled(): supplied argument is not a valid Image resource in /usr/share/wwwdev/d6/modules/imageapi/imageapi_gd.module on line 126.

On every single page:

    * recoverable fatal error: Object of class stdClass could not be converted to string in /usr/share/wwwdev/d6/drupal-stable/includes/bootstrap.inc on line 768.
    * warning: preg_match() expects parameter 2 to be string, object given in /usr/share/wwwdev/d6/drupal-stable/includes/bootstrap.inc on line 771.

Changing back to recent version. (which I used as well)

Upgreydd’s picture

I have the same error, i'm using ImageCache and ImageAPI, just try to change all "resize" actions in imagecache to "scale" that's work for me

johnnymugs’s picture

Hey all. Having this same problem. There's a fix here that's working for me so far:

http://tekkie.flashbit.net/drupal/getting-imageapi-and-imagecache-cope-w...

drewish’s picture

so shorter version of johnnybeggs's advice. add ini_set('zend.ze1_compatibility_mode', 0); to your settings.php file. i've got no idea if that works though.

casey_2000’s picture

ini_set('zend.ze1_compatibility_mode', 0);

IT WORKS. Sometimes it is because of hosting provider.

technicka’s picture

Same issue; I got rid of the "resize" action from my ImageCache preset and it worked.

goodghost’s picture

Alright, so that is an imagecache module bug. If you choose resize there are two fields, width and height and these are not mandatory, but should be. If you put one value (whatever if it's width or height) and save it, then while generating an image, php functions requires 2 values, 1 for width and 1 for height. And that is why the error is displayed. If you need to set only one value for width or height don't choose "Scale" function, use "Resize" instead. The script will generate the other one (not shown) depending on the first and will display the resized image. As you can see it's all about required fields in scale action which are not but should be!

tomogden’s picture

For me this error began when I added another image field to my node, which already had a multi-image field for a slideshow. Removed the second image field, but the problem persists.

I dug through all my imagecache presets, converted everything to 'resize', but to no avail. Emptied caches, ran update.php, entered the "ini_set('zend.ze1_compatibility_mode', 0);" script in my settings.php. No changes.

Rory’s picture

tomogden, I think goodghost means not to choose resize, but Scale instead.

oknate’s picture

I had the same issue. Tried clearing the cache, didn't work. Then I uninstalled imagecache and reinstalled it. Deleted my preset and recreated it, then it worked.

I think part of the problem was I didn't have the ImageAPI GD2 module enabled the first time, so there was no image toolkit when I enabled Imagecache.