Hello,
The website of my small publishing house has been running smoothly with Backdrop CMS for several years.
But today I have a big problem:
Without doing anything special (just writing an article), the public part of the site no longer works.

I looked in the reports, I have this error message:

Error: Undefined constant "pixel_density" in adaptive_image_resolution() (line 249 of /home/.../web/zinechdm_backdrop/modules/adaptive_image/adaptive_image.module).

The address of the site to realize the problem: https://zine.lechantdesmuses.fr/

I am really very annoyed. If anyone could help me out, that would be really great.
Thanks for your attention.

here is a screenshot of the current state of the frontend (only the site logo remains!)

Accepted answer

This is caused by a simple typo in line 249 of the file adaptive_image.module. The variable pixel_density is missing the "$". 

Elode, this is easy to fix. Just edit the file and add "$". Then you should be able to use PHP 8 (plus the module will do what's supposed to do there!)

It looks like this module is abandoned. It hasn't been touched since 2016.

Comments

Olafski's picture

Hello Elode,

indeed an annoying situation, but I'm confident it can be resolved. The error message comes from the Adaptive Image module. I've had a look at the module's issue queue and found a report about exactly that message:

https://github.com/backdrop-contrib/adaptive_image/issues/2

Interestingly, the PHP message in the report is called a "notice", not an "error". This could indicate that the issue wasn't critical in earlier PHP versions, but nowadays it is. Do you know if the PHP version of your hosting service changed recently? And can you anyway have a look at the current PHP version where your site is running on? You find it on the Status report of your site (in the Admin bar: Reports > Status report).

Thank you for the answer :)
I looked at the php version: php 8.0
I had changed it myself a few months ago and hadn't noticed any problems so far.

Thanks for help :)

Olafski's picture

Thanks for the feedback! Can you switch the PHP version temporarily back to 7.4 and see if the error goes away? If that's the case, I'd suggest to report the problem with PHP 8 in the Adaptive Image issue queue.

It's probably in any case a good idea to report the problem in the issue queue. As far as I know, the maintainer of the Adaptive Image module hasn't been very active for Backdrop recently, but hopefully others can chime in and help to fix the issue.

I don't use the Adaptive Image module, but I guess in the meantime, as a temporary workaround to make your site working again, you could consider to disable the Adaptive Image module and/or to replace the image styles which use the module.

I followed your advice: put back version 7.4 of php.
… and it works !
I'm going to report the problem as you suggest.
Thanks a lot :)

This is caused by a simple typo in line 249 of the file adaptive_image.module. The variable pixel_density is missing the "$". 

Elode, this is easy to fix. Just edit the file and add "$". Then you should be able to use PHP 8 (plus the module will do what's supposed to do there!)

It looks like this module is abandoned. It hasn't been touched since 2016.

I followed your advice. So, I was able to put back version 8 of php.
Thanks very much :)