drush generate-realistic

Fatal error: Call to undefined function imagepng() in /path/to/drupal/sites/all/modules/contrib/devel/devel_generate/image.devel_generate.inc on line 91
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function imagepng() in /path/to/drupal/sites/all/modules/contrib/devel/devel_generate/image.devel_generate.inc,

Comments

alberto56’s picture

I can't reproduce this myself, but it was reported to me. Anyone else having this issue please let me know if you can run drush generate-content.

alberto56’s picture

Also, please try using jpg files instead of png files for your realistic dummy content and let me know if the problem still occurs.
If it _does_ work with drush generate-content, please confirm the files thus created are jpg and/or png.

djac’s picture

I reported the issue :)

I'm running MAMP Pro, PHP 5.3.29.
Maybe a missing PHP library?

What is odd is that I did get a single node created with a realistic dummy image. Perhaps imagepng() wasn't required to create that node, but is required to create other nodes?

alberto56’s picture

Status: Active » Postponed (maintainer needs more info)

Seems that this function is in the GD image library http://php.net/manual/en/function.imagepng.php.

@djac can you please

(1) confirm that you are getting this problem on the command line OR on the GUI

(2) if the problem occurs on the command line, please provide the output of the following:

php --info|grep GD

(3) if the problem occurs on the GUI, please install and enable the devel module and save as source the output of the page http://YOURWEBSITE/devel/phpinfo

(4) find the realistic images, remove them all and replace them with JPGs instead of PNGs, and let me know if the problem persists

Thanks!

Albert

alberto56’s picture

djac’s picture

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

I took a look at devel_generate_image(), which tries to save a temporary png to Drupal's temp dir.
I noticed that there were some .png files in my temp dir, but they were zero bytes.

I changed my temp directory to one where I know Drupal has write permissions, and that resolved the issue.

Not sure why Drupal couldn't create the png's properly in my default temp directory (I use the same temp directory for all of my dev sites), but I can investigate that on my end.

Thanks! Closing issue.

alberto56’s picture

Category: Bug report » Support request

Anyone on MAMP or MAMP Pro still having this issue: it might be that your webserver is using a different PHP executable than your command line, and a different php.ini file.

Can you please do the following and let me know what the result is?

php -ini|grep GD

this should give you the result:

GD Support => enabled
GD Version => bundled (2.1.0 compatible)

Now log on to your local website, make sure the devel module is enabled and you are logged in, and visit mysite.local/devel/phpinfo, and make sure you see the line "GD Support => enabled" somewhere there.
Also make sure, that the version of PHP on that page correspondes to "php -v" on the command line, and that the "Loaded configuration file" on that page corresponds to the result of "php --ini" on the command line.

If you have mismatched versions, please see the "Additional Configurations for Mamp:" section on the Drush configuration documentation page.

alberto56’s picture

Status: Closed (fixed) » Active

I'm setting this back to active because some users do not have a solution of this.

alberto56’s picture

When you type:

which php

If you get the result

/usr/bin/php

please confirm that you applied the instructions in the "Additional Configurations for Mamp:" on http://docs.drush.org/en/master/configure/? If not please read them through and apply them, and when you are done, run which php again and it should give you a path which is something like

/Applications/MAMP/bin/php/php5.6.2/bin/php
jeremycaldwell’s picture

I can confirm that making the changes to your .bash_profile fixes the issue for MAMP users.

Here is what I added to mine to get it working:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.5.14/bin:$PATH"

Remember to close terminal and reopen it to run the command after making this change.

alberto56’s picture

Status: Active » Fixed

Marking as fixed. Please change back to active if you are still experiencing the problem.

Status: Fixed » Closed (fixed)

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