-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Notice in random image module #23766
Comments
Curious to what height / width values you are using? |
They are empty... |
@jjnxpct Is this happening with all images or randomly? |
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! |
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/23766 |
Closing as no-reproducible. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23766. |
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
System information (as much as possible)
Joomla! 3.9.2
PHP 7.2.13
Additional comments
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.
The text was updated successfully, but these errors were encountered: