Jump to content
TNG Community

Implicit conversion from float 20.5 to int loses precision in ... watermark.php on line 331


JMM

Recommended Posts

  • TNG 15.0.2
  • PHP 8.4.8
  • MariaDB 11.4.7
  • watermark_v15.0.0.6.cfg

Hello folks,

I have a slight hiccup with Michel's @Michel KIRSCH Watermark mod v15.0.0.6, and I have no idea what is causing this problem.  On my main page, I have a random photo section, with the image changing randomly every time the main page is accessed.  The error that pops up sometimes (i.e. only every now & then), is:

Deprecated: Implicit conversion from float 20.5 to int loses precision in D:\Web\~TNG\~Sites\TNG-TestSite-NitroWings-v15.0.2\watermark.php on line 331

What's weird is, when that error appears for a picture, the next time that same picture is randomly displayed, there is no error associated with that picture.

That mod is working perfectly on my 2 external TNG 15.0.2 sites (public live site & public test site), which are both currently using PHP 8.3.21 and MySQL 8.0.39-cll-lve under LiteSpeed (Apache) v2.4.63.

That mod is also working perfectly on my local TNG 14.0.6 site, which is using PHP 8.4.8 and MariaDB 11.4.7 under Windows 10 Pro x64.

The hiccup is only on my local TNG 15.0.2 test site, which is also using PHP 8.4.8 and MariaDB 11.4.7 under Windows 10 Pro x64.

Thinking that it may be related to my PHP, I rolled my local TNG 15.0.2 test site back to PHP 8.2.5, but the problem was still there, so I don't believe that it's PHP-related.  Plus, my local TNG 14.0.6 test site does not display this error at all, so it can't be PHP-related.

It can't be related to MariaDB either, because it's the same DB that my local TNG 14.0.6 site uses, which does NOT produce that error message.

And it can't be related to TNG, because my 2 external TNG 15.0.2 sites work fine & also do NOT produce that error message.

And it also can't be related Windows versus LiteSpeed/Apache, because my local TNG 14.0.6 site also works fine & also does NOT produce that error message.

Now, just before posting this, I got 2 more errors:

Warning: imagecreatefromstring(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in D:\Web\~TNG\~Sites\TNG-TestSite-NitroWings-v15.0.2\watermark.php on line 260
Warning: imagecreatefromstring(): gd-png: libpng warning: iCCP: cHRM chunk does not match sRGB in D:\Web\~TNG\~Sites\TNG-TestSite-NitroWings-v15.0.2\watermark.php on line 260

Those 2 iCCP warnings popped up when TNG displayed a specific picture, which 99% of the time displays fine, but that same picture every now & then produces the Implicit conversion from float 20.5 to int loses precision warning, and now this one time the above 2 iCCP warnings.  So those warnings are not consistent.  Jan Wessel found the cause of this problem & posted about it & the fix HERE 7 years ago, so I can fix the latter 2 iCCP warnings, but those warnings are appearing sporadically.

I'm going crazy (it doesn't take much :mrgreen:), and I'm running out of ideas as to what is causing these problem, and I am hoping that someone else can think of a possible cause.

Thanks in advance.

Regards,
John

Link to comment
Share on other sites

  • 3 weeks later...
Michel KIRSCH

I can't reproduce here.

It seems that in some circumstances, PHP does this implicit conversion. (Circumstances are nebulous...)

To avoid that, the concerned number must be explicitly converted before being used.

Try this file (replace directly your version with this one in your TNG root)

and let me know...

Michel

watermark.php

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...