Skip to content

Commit 176ed65

Browse files
committed
Releasing 1.1.15
2 parents acd3017 + 4045f21 commit 176ed65

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/TgUtils/ImageUtils.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,31 @@
55
class ImageUtils {
66

77
/**
8-
* Creates a thumbnail image from the given image at the path.
8+
* Creates a thumbnail image from the given image at the path. (shorthand for createVariation)
99
* @param string $imagepath - path of original image
1010
* @param int $maxWidth - maximum new width
1111
* @param int $maxHeight - maximum new height
1212
* @param string $targetDir - target directory
1313
* @return string - the path of the new image file, e.g. /target/dir/basename.variation.png (or NULL in case of GD issues)
1414
*/
1515
public static function createThumbnail($imagePath, $maxWidth, $maxHeight, $targetDir = NULL) {
16+
return self::createVariation($imagePath, 'thumbnail', $maxWidth, $maxHeight, $targetDir);
17+
}
18+
19+
/**
20+
* Creates a thumbnail image from the given image at the path.
21+
* @param string $imagepath - path of original image
22+
* @param string $variation - new variation name to be used
23+
* @param int $maxWidth - maximum new width
24+
* @param int $maxHeight - maximum new height
25+
* @param string $targetDir - target directory
26+
* @return string - the path of the new image file, e.g. /target/dir/basename.variation.png (or NULL in case of GD issues)
27+
*/
28+
public static function createVariation($imagePath, $variation, $maxWidth, $maxHeight, $targetDir = NULL) {
1629
if (!file_exists($imagePath)) {
1730
$targetPath = NULL;
1831
} else {
19-
$targetPath = self::getNewPath($imagePath, 'thumbnail', $targetDir);
32+
$targetPath = self::getNewPath($imagePath, $variation, $targetDir);
2033
}
2134

2235
if ($targetPath != NULL) {

0 commit comments

Comments
 (0)