-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: hybrid integration of bild & ImageMagick (#269)
* fix: hybrid integration of bild and ImageMagick * chore: format code * fix: add support for .tif extension * fix: various issues * fix: base mosaic on preview
- Loading branch information
Showing
12 changed files
with
156 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package helper | ||
|
||
func AspectRatio(width, height, originalWidth, originalHeight int) (int, int) { | ||
if width == 0 && height == 0 { | ||
return originalWidth, originalHeight | ||
} | ||
if width == 0 { | ||
width = (height * originalWidth) / originalHeight | ||
} | ||
if height == 0 { | ||
height = (width * originalHeight) / originalWidth | ||
} | ||
return width, height | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package identifier | ||
|
||
import ( | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
type ImageIdentifier struct{} | ||
|
||
func NewImageIdentifier() *ImageIdentifier { | ||
return &ImageIdentifier{} | ||
} | ||
|
||
func (ii ImageIdentifier) IsJPEG(path string) bool { | ||
path = strings.ToLower(path) | ||
return filepath.Ext(path) == ".jpg" || | ||
filepath.Ext(path) == ".jpeg" || | ||
filepath.Ext(path) == ".jpe" || | ||
filepath.Ext(path) == ".jfif" || | ||
filepath.Ext(path) == ".jif" | ||
} | ||
|
||
func (ii ImageIdentifier) IsPNG(path string) bool { | ||
path = strings.ToLower(path) | ||
return filepath.Ext(path) == ".png" | ||
} | ||
|
||
func (ii ImageIdentifier) IsTIFF(path string) bool { | ||
path = strings.ToLower(path) | ||
return filepath.Ext(path) == ".tiff" || | ||
filepath.Ext(path) == ".tif" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.