Skip to content

Commit

Permalink
Fix a image prorate error
Browse files Browse the repository at this point in the history
Some svg images can cause this problem.

PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string / string in /kod/app/kod/ImageThumb.class.php:94
Stack trace:
#0 /kod/app/controller/explorer.class.php(1100): ImageThumb->prorate('/kod/data...', 250, 250)
#1 /kod/app/core/Application.class.php(64): explorer->image()
#2 /kod/app/core/Application.class.php(104): Application->appRun('explorer', 'image')
#3 /kod/index.php(114): Application->run()
#4 {main}
  thrown in /kod/app/kod/ImageThumb.class.php on line 94
  • Loading branch information
bbbboom authored Apr 23, 2023
1 parent b29692d commit 39095a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/kod/ImageThumb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ function distortion($toFile, $toW, $toH){
}
// 生成按比例缩放的缩图
function prorate($toFile, $toW, $toH){
if(!$this->im){
return false;
}
$toWH = $toW / $toH;
$srcWH = $this->srcW / $this->srcH;
if ($toWH<=$srcWH) {
Expand Down

0 comments on commit 39095a1

Please sign in to comment.