Разрешение на - в названии файла
This commit is contained in:
parent
6173eb4892
commit
958033a057
3 changed files with 75 additions and 76 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Tools_Image
|
||||
{
|
||||
{
|
||||
static function load($uri)
|
||||
{
|
||||
$e = strtolower(pathinfo($uri, PATHINFO_EXTENSION));
|
||||
|
|
@ -10,17 +10,17 @@ class Tools_Image
|
|||
case 'jpeg': case 'jpg': return imagecreatefromjpeg($uri);
|
||||
case 'gif': return imagecreatefromgif($uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function fit($image, $prewidth, $preheight, $force = true)
|
||||
{
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
$height = imagesy($image);
|
||||
$percent = min($prewidth / $width, $preheight / $height);
|
||||
if ($percent > 1 && !$force) $percent = 1;
|
||||
$new_width = $width * $percent;
|
||||
$new_height = $height * $percent;
|
||||
|
||||
|
||||
|
||||
$image_p = imagecreatetruecolor($new_width, $new_height);
|
||||
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
|
||||
|
|
@ -36,4 +36,4 @@ class Tools_Image
|
|||
case 'gif': imagegif($image, $uri); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue