Danack
Repos
189
Followers
132

🌈 The Imagick PHP extension 🌈

C
427
111

Notes on PHP RFCs, and topics that occur repeatedly on PHP internals

191
10

An example of all the Imagick functions

116
37

Allows route callables to be dispatched by Auryn.

7
0

An example of Slim, Auryn, Docker and React.

8
2

Generates config files from PHP based templates and PHP style config files.

14
1

Events

Created at 2 days ago
opened issue
Add a reference to friend class static analysis tool

as Mr DaveLiddament has this: https://github.com/DaveLiddament/php-language-extensions

Created at 2 days ago
no is the default

https://www.jeffgeerling.com/blog/2016/why-i-close-prs-oss-project-maintainer-notes

Created at 5 days ago

Take two documents into the shower? Not me, I just merge them and go.

Created at 1 week ago

Haaaaaaaaands.

Created at 1 week ago

Upgrade all of the things.

Add support for detecting literal string usages.

Not particularly great validation of template.

Added words in readme.

Added example for reference from is_literal.

Added example so they can be easily referenced from RFC.

wip, changing computers.

wip.

CS

WIP that was missed. Tests still failing due to reasons.

Merge branch 'separate_types_rebase' into moving_to_git_ci

  • separate_types_rebase: WIP that was missed. Tests still failing due to reasons. CS wip. wip, changing computers. Added example so they can be easily referenced from RFC. Added example for reference from is_literal. Added words in readme. Not particularly great validation of template. Add support for detecting literal string usages. Upgrade all of the things.

Updating tests.

Created at 1 week ago
create branch
Danack create branch moving_to_git_ci
Created at 1 week ago

Poke example output.

Add getVersion and getConfigureOptions examples.

remove dead lines.

Fix clutImage example. Site still needs an update to latest imagick to work correctly.

Created at 1 week ago
issue comment
php Imagick class throws exception when instantiated with uploaded SVG file

Looking at the strace output, I'm pretty sure this is a difference between how ImageMagick is being installed on the different machines, and/or some related programs and isn't a problem with Imagick itself.

Before I spend any more time on this, can you remind me, does your company sponsor either PHP or Imagick?

Links to sponsor them are https://opencollective.com/phpfoundation and https://github.com/sponsors/Danack .

Created at 1 week ago
issue comment
php Imagick class throws exception when instantiated with uploaded SVG file

gist.github.com ?

Created at 1 week ago
issue comment
php Imagick class throws exception when instantiated with uploaded SVG file

Do you have as example SVG that fails to work? Uploading that here (or emailing it to me if it's not publicly shareable), would allow me to investigate on my computer.

For that file, can you try creating an Imagick object from it with a PHP command line script? That would make it easier to debug.

In particular, installing strace and running the PHP script through it with:

strace -f -s 256 php debug.php > strace_output_with_follow.txt 2>&1

Would show exactly which bit was failing.

My guess is that Imagick/ImageMagick is calling an external program to render the SVG to a bitmap, and that is failing....and then for some reason it's not falling back to the internal SVG renderer...

Also, please could you dump the results of Imagick::getVersion() here just in case that is relevant.

Created at 1 week ago
issue comment
Bug #81016 imagick throwing out “Uncaught ImagickException: unable to open file”

You probably want to open a bug at https://github.com/imagick/imagick .

Is it that imagick does not need to write then read an additional temporary file for some file types (jpeg), but does for others (svg)?

That is correct. JPGs can be loaded directly into memory, ImageMagick (the library that actually does the image processing under Imagick) can delegate rendering SVGs to a bitmap to other programs such as Inkscape.

So, why do I get this error for some files and not others?

Computers were a mistake.

Uploading of SVG files used to work with the same setup but with PHP 7.0 on Ubuntu 16.04, so this appears to be some kind of regression,

When you open a bug at the Imagick repo, please can you list exactly which versions of Imagick + ImageMagick you are using, and also compare the delegates.xml file that will be on each system. The delegates.xml file say which delegate programs ImageMagick will attempt to use to decode files it can't decode itself.

Also, please can you say whether Inkscape is installed on each machine and the version of it, as that apparently is a thing: https://github.com/Imagick/imagick/issues/551

Created at 2 weeks ago
issue comment
imagick php script fails when run with cron

For the record, php on the command line can have a different ini file than php running in a webserver.

You probably don't have extension=imagick.so in the appropriate ini file. That can be found by running php --ini

Created at 2 weeks ago
issue comment
Can't seem to run imagick if i compile it from M1 on Monterrey 12.1 (symbol not found in flat namespace '_AcquireAlignedMemory)

I have an new M1 on the way. Please can someone post a list of instructions of how you are trying to compile Imagick, so that I can try to reproduce the error you are seeing.

Created at 2 weeks ago
closed issue
Trouble compiling, can't pass tests

I'm sure this is not a problem with the imagick code per se, but I'm trying to compile imagick from source and it's not working. My basic story is as follows: we're running on a fresh Ubuntu 20.4 system. We want to run imagemagick 7.x, which isn't available as a normal Ubuntu package. I downloaded the ImageMagick-7.1.0-47 source code and compiled that, it appears to be working. Then did git clone https://github.com/Imagick/imagick, phpize, configure, make. I had to edit the Makefile to

add -I/usr/local/include/ImageMagick-7 to INCLUDES (otherwise fatal error: MagickWand/MagickWand.h: No such file or directory) add -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 to CPPFLAGS (otherwise lots of warnings)

with those changes, I can run make without errors or warnings. However, when I run make test all of the tests fail. I tried manually running tests/001_imagick_readimage.sh and got this fatal error:

/usr/bin/php8.1: symbol lookup error: /root/imagick/modules/imagick.so: undefined symbol: MagickWandGenesis

fwiw, I have extension=imagick.so in my system php.ini file, but I seem to get the same results whether it's there or not. Not surprisingly php -m does not report imagick in any case.

Again, I know is usually a place for people who are actually troubleshooting the imagick code, so I'm sorry to intrude with such a user-level question. But I don't know where else to turn, since the problem does seem specific to the imagick source distribution. Can you help me?

Created at 2 weeks ago
issue comment
Trouble compiling, can't pass tests

anyway, closing this as there's nothing for me to fix.

Created at 2 weeks ago

Update rfc_attitudes.md

made list be a list.

Created at 2 weeks ago
issue comment
Trouble compiling, can't pass tests

"test suite requires format png but not available"

For that, apt install libpng, and then reconfigure and recompile ImageMagick, and then Imagick.

I guess the question is: why didn't it work the first time?

Who knows...there's not much point investigating why stuff failed to work in the past.

But you might at some point want to investigate using docker, vagrant or something similar for doing development work in. That allows you to have a reproducible environment, which takes some of the surprise away....

If you happen to have a hint as to why php -m doesn't show imagick,

The tests setup their own ini settings. You have to manually add extension=imagick.so to the php ini file use by PHP on the command line in general. The location of that file can be found with php --ini

Anyway, thank you very much. You've been extremely helpful, and whatever caused the issue,

No worries. Probably just balances out some of the trolling I do elsewhere...

Created at 3 weeks ago
issue comment
Trouble compiling, can't pass tests

It seems like there should be something before the dashes,

Yeah.

I've posted the full version of my MagickWand-config program below. That's just for info, not copying. But basically it should probably be running something like:

/usr/bin/pkg-config --cflags MagickWand-7.Q16HDRI

Can you:

  • install pkg-config through apt/yum.
  • rerun configure for ImageMagick.
  • make clean && make install for ImageMagick, and see if /usr/local/bin/MagickWand-config gets updated to something that gives sensible output for /usr/local/bin/MagickWand-config --cflags

If it still doesn't look like it's generating an appropriate MagickWand-config program, please can you post the config.log of ImageMagick....but at that point I might need to pass you onto the ImageMagick people.

#!/bin/sh
#
# Configure options script for re-calling MagickWand compilation options
# required to use the MagickWand library.
#

prefix=/usr/local
exec_prefix=${prefix}

usage="\
Usage: MagickWand-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]"

if test $# -eq 0; then
      echo "${usage}" 1>&2
      echo "Example: gcc \`MagickWand-config --cflags --cppflags\` -o wand wand.c \`MagickWand-config --ldflags --libs\`" 1>&2
      exit 1
fi

while test $# -gt 0; do
  case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
  esac
  case $1 in
    --prefix=*)
      prefix=$optarg
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      ;;
    --exec-prefix)
      echo $exec_prefix
      ;;
    --version)
      echo '7.1.0-13 Q16 HDRI'
      ;;
    --cflags)
      /usr/bin/pkg-config --cflags MagickWand-7.Q16HDRI
      ;;
    --cxxflags)
      /usr/bin/pkg-config --cflags MagickWand-7.Q16HDRI
      ;;
    --cppflags)
      /usr/bin/pkg-config --cflags MagickWand-7.Q16HDRI
      ;;
    --ldflags)
      /usr/bin/pkg-config --libs MagickWand-7.Q16HDRI
      ;;
    --libs)
      /usr/bin/pkg-config --libs MagickWand-7.Q16HDRI
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

Created at 3 weeks ago
issue comment
Trouble compiling, can't pass tests

Apparently there is a shortcut for closing issues which I hit by accident...

Created at 3 weeks ago
reopened issue
Trouble compiling, can't pass tests

I'm sure this is not a problem with the imagick code per se, but I'm trying to compile imagick from source and it's not working. My basic story is as follows: we're running on a fresh Ubuntu 20.4 system. We want to run imagemagick 7.x, which isn't available as a normal Ubuntu package. I downloaded the ImageMagick-7.1.0-47 source code and compiled that, it appears to be working. Then did git clone https://github.com/Imagick/imagick, phpize, configure, make. I had to edit the Makefile to

add -I/usr/local/include/ImageMagick-7 to INCLUDES (otherwise fatal error: MagickWand/MagickWand.h: No such file or directory) add -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 to CPPFLAGS (otherwise lots of warnings)

with those changes, I can run make without errors or warnings. However, when I run make test all of the tests fail. I tried manually running tests/001_imagick_readimage.sh and got this fatal error:

/usr/bin/php8.1: symbol lookup error: /root/imagick/modules/imagick.so: undefined symbol: MagickWandGenesis

fwiw, I have extension=imagick.so in my system php.ini file, but I seem to get the same results whether it's there or not. Not surprisingly php -m does not report imagick in any case.

Again, I know is usually a place for people who are actually troubleshooting the imagick code, so I'm sorry to intrude with such a user-level question. But I don't know where else to turn, since the problem does seem specific to the imagick source distribution. Can you help me?

Created at 3 weeks ago
closed issue
Trouble compiling, can't pass tests

I'm sure this is not a problem with the imagick code per se, but I'm trying to compile imagick from source and it's not working. My basic story is as follows: we're running on a fresh Ubuntu 20.4 system. We want to run imagemagick 7.x, which isn't available as a normal Ubuntu package. I downloaded the ImageMagick-7.1.0-47 source code and compiled that, it appears to be working. Then did git clone https://github.com/Imagick/imagick, phpize, configure, make. I had to edit the Makefile to

add -I/usr/local/include/ImageMagick-7 to INCLUDES (otherwise fatal error: MagickWand/MagickWand.h: No such file or directory) add -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 to CPPFLAGS (otherwise lots of warnings)

with those changes, I can run make without errors or warnings. However, when I run make test all of the tests fail. I tried manually running tests/001_imagick_readimage.sh and got this fatal error:

/usr/bin/php8.1: symbol lookup error: /root/imagick/modules/imagick.so: undefined symbol: MagickWandGenesis

fwiw, I have extension=imagick.so in my system php.ini file, but I seem to get the same results whether it's there or not. Not surprisingly php -m does not report imagick in any case.

Again, I know is usually a place for people who are actually troubleshooting the imagick code, so I'm sorry to intrude with such a user-level question. But I don't know where else to turn, since the problem does seem specific to the imagick source distribution. Can you help me?

Created at 3 weeks ago
issue comment
Trouble compiling, can't pass tests

It looks like you have:

PATH: /usr/local/include/ImageMagick-7
PATH: /usr/local/include/ImageMagick-7/MagickWand/

In you path settings. Please can you delete those, they really shouldn't be necessary.

Can you make sure you've deleted any makefiles that you might have edited, and rerun phpize and ./configure to regenerate them.

Please can you run the commands /usr/local/bin/MagickWand-config --libs and /usr/local/bin/MagickWand-config --cflags and paste their output here.

The configure command is showing an error on these lines:

configure:4316: checking for MagickGetVersion
configure:4316: cc -o conftest -g -O2   conftest.c   >&5
/usr/bin/ld: /tmp/ccbuP6Bd.o: in function `main':
/root/imagick/conftest.c:44: undefined reference to `MagickGetVersion'

It should look more like:

configure:4556: cc -o conftest -g -O2   conftest.c  -L/usr/local/lib -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI >&5





                                
Created at 3 weeks ago
issue comment
Can't seem to run imagick if i compile it from M1 on Monterrey 12.1 (symbol not found in flat namespace '_AcquireAlignedMemory)

I really can't investigate this without info.

I would love to have an M1 to test on.

I am saving up to buy a new MBP. In lieu of providing info, if any one wants to speed up me acquiring that MBP so I can investigate myself, my sponsors page is here: https://github.com/sponsors/Danack and one-off donations would be appreciated.

Created at 3 weeks ago
issue comment
Trouble compiling, can't pass tests

Can you confirm you ran make install when building ImageMagick?

If so can you post the whole contents of config.log the is generated after running the configure command?

But I couldn't find another way to get that path included.... Advice on the proper way to do that would be greatly appreciated.

If the appropriate tools are installed, you shouldn't need to do anything.

Every C (or C-like) library that gets installed with headers should be either setting up a "package config" info, of where to find the C headers and libraries, or because ImageMagick is ancient it has its own custom way of doing that also.

The most likely thing is it sounds like ImageMagick was compiled but not installed. But it's kind of confusing that you aren't getting a bigger error message saying what the error is.

Created at 3 weeks ago
issue comment
Trouble compiling, can't pass tests

I had to edit the Makefile to

That's a not a good idea.

Please can you say the original error you get from compiling after doing phpize, configure, make install.

is usually a place for people who are actually troubleshooting the imagick code,

Created at 3 weeks ago
issue comment
COLORSPACE_LAB seems to be deprecated but why?

btw @knivey you can always just pass a raw integer through any function that takes a constant. Looking at the enum list in the ImageMagick code, LabColorspace might be either 5 (for ImageMagick 6) or 11 (for ImageMagick 7).

Created at 3 weeks ago
issue comment
COLORSPACE_LAB seems to be deprecated but why?

Not sure, colorspaces always confuse me.

Just looking at the code, I think maybe the people who maintain ImageMagick were planning to give LABColorspace a more accurate name. Looking at the constants in colorspace.h of ImageMagick I can see:

  LabColorspace,
  LCHColorspace,           /* alias for LCHuv */
  LCHabColorspace,         /* Cylindrical (Polar) Lab */
  LCHuvColorspace,         /* Cylindrical (Polar) Luv */

The new versions are available as:

IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LCHAB", LCHabColorspace);
IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LCHUV", LCHuvColorspace);

in Imagick.

Can you try using one of those?

LabColorspace seems to be missing from at least once place in the ImageMagick code where I would expect it, so the fact it's still listed is probably a problem for ImageMagick.

Also, if you could provide a useful example of using LabColorspace, I'd love to see one as I normally avoid touching colorspace myself and don't have a good test for their behaviour.

Created at 3 weeks ago

Upgraded PHP.

Created at 3 weeks ago

The docker default settings for output are annoying. We need to be able to see errors in the build more easily.

Prepare release.

Rebased dev changes.

Add test for Imagick::clutImageWithInterpolate.

ignore debugging directories.

Created at 3 weeks ago