SF.net SVN: phpwiki:[11060] trunk/lib/plugin/PhotoAlbum.php

vargenau--- via phpwiki-checkins <[email protected]> Tue, 18 Jul 2023 14:15:47 +0000
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 11060
          http://sourceforge.net/p/phpwiki/code/11060
Author:   vargenau
Date:     2023-07-18 14:15:47 +0000 (Tue, 18 Jul 2023)
Log Message:
-----------
lib/plugin/PhotoAlbum.php: force int return type for function newSize

Modified Paths:
--------------
    trunk/lib/plugin/PhotoAlbum.php

Modified: trunk/lib/plugin/PhotoAlbum.php
===================================================================
--- trunk/lib/plugin/PhotoAlbum.php	2023-07-18 13:56:14 UTC (rev 11059)
+++ trunk/lib/plugin/PhotoAlbum.php	2023-07-18 14:15:47 UTC (rev 11060)
@@ -520,17 +520,17 @@
      * Calculate the new size in pixels when the original size
      * with a value is given.
      *
-     * @param integer $oldSize Absolute no. of pixels
+     * @param  integer $oldSize Absolute no. of pixels
      * @param  mixed   $value   Either absolute no. or HTML percentage e.g. '50%'
-     * @return integer New size in pixels
+     * @return int              New size in pixels
      */
     private function newSize(int $oldSize, $value): int
     {
         if (trim(substr($value, strlen($value) - 1)) != "%") {
-            return $value;
+            return intval($value);
         }
         $value = str_replace("%", "", $value);
-        return round(($oldSize * $value) / 100);
+        return (int)round(($oldSize * $value) / 100);
     }
 
     /**

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.