Imageplus failed to generate thumbnail


when i try to add an image with imageplus, I receive the following error:


I do not know if it is related, but each time i try to add an image via imageplus, I can see this error in the log viewer

[2024-02-12 15:27:40] (ERROR @ /web/htdocs/ : 45) PHP warning: Constant IMG_AVIF already defined

Thank you for any help.

Hi, If the image is of the file type AVIF (as suggested by the error log) it may be that it is not supported by imageplus, or that imageplus needs to be updated to support it. You may also find that your PHP version needs to be upgraded to 8.1. As usual please don’t upgrade or update anything without first doing a full backup of you site and database!

HI, the image is not an AVIF file, I receive the same error also with older images.
Imageplus used to work on this website… i think it stopped working after a bunch of updates.
I also updated PHP to 8.1 with no success…

The error message you posted gets generated in Javascript.
So I don’t think it’s a problem with PHP.

The image you selected, is it possible to display it on the site using a normal <img> tag?
Any weird characters in the image-URL?
Do you use a media-source? Is it set up correctly?

Hi, i can see the image in the Media Browser, and if I add the same image using with the “mixed image input” TV it works.
I have this problem when i try to upload any images via imageplus.
I use a media source with these settings:

After updating to php 8.1 from 8.0, the AVIF error is no more in the logs…

Are you using the latest version of Image Plus? I got that message at one point, and some sort of update fixed it, although I can’t remember what that was. This was on sites running PHP 7.4, so it wasn’t a PHP issue for me.

You could try to log the (erroneous) image path the ImagePlus extra tries to open.

It’s a bit tricky, because all the JS code is minified.
But basically open this file

then at the position where this code is


add a console log statement to ouput the “src” attribute of the image:

s.src=o+this.image.sourceImg.src;console.log("image-src = "+s.src);

Then hard refresh the browser and open the developer tools (“Console” tab) to check the logged output.

Hi, i added the logging in the console a this is the (wrong) image path:

This is a multilanguage website, can be something related to that?

Try removing the slash (/) at the beginning of the “baseUrl” and “basePath” properties in the Media Source:

assets/usermedia/ instead of /assets/usermedia/.

1 Like

I just chanded the path before your last reply and it worked! Thank you for ponting me in the right direction!

However this is odd, before the update, it used to work fine with the slash a the beginning of both paths…

Thank you again for your help.

Right! That was the fix when I had this problem a year ago. I had to update the media sources on most of my sites.

An update to MODX changed how the paths work. It fixed some other problems with paths.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.