When using the random image module we get a PHP notice:
Backend log: PHP Notice: A non well formed numeric value encountered in /home/******/domains/******/public_html/modules/mod_random_image/helper.php on line 52\n
Joomla! 3.9.2
PHP 7.2.13
Line 52 is:
$newheight = min($height, (int) ($width / $coeff));
I think maybe this would work:
$newheight = min($height, ((int) $width / (int) $coeff));
Not sure if that's the right way to fix it.
And maybe it needs to be changed on more line in the module.
Labels |
Added:
?
|
They are empty...
I believe this is happening with all images. But when I tested this I noticed that after opening the module in the backedn and saving it there was a default '100' set in the width field. Making this empty and then saving the module put the '100' back again. And now the images are all 100 px in stead of 100%.
So I now changed the default.php view by hardcoding '100%' in the image width to fix this on this site. (It might also work with CSS setting the width to 100% !imnportant))
I guess it was still working on the site until I opened and saved the module. Maybe because of changes to the module code in the recent past?
Anyway can you reproduce this with behavoiur (defaulting to 100 when left empty)? Or is this intended?
The PHP notices might be related to this? Or not?
I can't reproduce the notices. I did touch this module in #20856 but (intentionally) left its functionality as it was. I don't see how it was possible to set the width to 100% because when no value was entered, it defaulted to 100px:
joomla-cms/modules/mod_random_image/helper.php
Lines 39 to 42 in 9217057
Hi! It's strange, but I don't see the PHP notices anymore. Also I reverted back to the original module code. I used CSs to set the image width to 100% so that is being used in the template in stead of the 100px setting in the module.
We use 100% because we want the image to scale with the browser width.
I guess no need for changes then ;-) Thanks for your help!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-02-06 16:07:40 |
Closed_By | ⇒ | joomla-cms-bot |
Closed_Date | 2019-02-06 16:07:40 | ⇒ | 2019-02-06 16:07:42 |
Closed_By | joomla-cms-bot | ⇒ | Quy |
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/23766
Closing as no-reproducible.
Curious to what height / width values you are using?