Multiple variables through wp_get_image_editor

I want to merge 2 images with imagick.
I already know how to merge them with imagick, but I need to pass 2 variables through wp_get_image_editor to get this to work.

I named the 2 variables $background and $logo.
$background contains the background image path.
$logo contains the logo image path.

Read More

Does anyone know how I should do this?

Related posts

1 comment

  1. Mike Schroder said:

    “WP_Image_Editor is built to handle one file at a time, and there isn’t anything built in to combine two images by default.

    The main reason here is that the files in-memory aren’t compatible with one-another if different editors (say, GD and Imagick) are used for each.

    There are a few different ways to handle it, of course, but one way to solve the problem here would be to load one of the two images, then extend the Imagick editor (or both editors, if you prefer more compatibilty) to support combining images. Say, with a $image->combine( ‘filename’ ) method.

    First, you’d load one of the images with wp_get_image_editor() (and specify that ‘combine’ is a required method), then call your combine method while specifying the second image.”

Comments are closed.