-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/tests export-ignore | ||
/docs export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.scrutinizer.yml export-ignore |
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,13 @@ | ||
# Changelog | ||
|
||
Notable changes to this project will be documented in this file. | ||
|
||
## [1.0.1] | ||
|
||
- Fix typo in README.md | ||
- Add CHANGELOG & docs | ||
|
||
## [1.0.0] | ||
|
||
- Adopt semantic versioning releases | ||
- Release versions |
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 |
---|---|---|
@@ -1,42 +1,40 @@ | ||
# Automatically scale down uploaded images for SilverStripe 3 | ||
An extension to automatically scale down all new uploaded images in SilverStripe 3. If the uploaded | ||
image is larger than a preconfigured size, it will be scaled down. The extension also supports | ||
auto-rotation of JPG images eg: portrait images taken with digital cameras or cellphones. | ||
|
||
An extension to automatically scale down all new uploaded images in SilverStripe 3\. If the uploaded image is larger than a preconfigured size, it will be scaled down. The extension also supports auto-rotation of JPG images eg: portrait images taken with digital cameras or cellphones. | ||
|
||
## Requirements | ||
* SilverStripe 3+ | ||
* GD support in PHP | ||
|
||
- SilverStripe 3+ | ||
- GD support in PHP | ||
|
||
## Usage | ||
Simply install the module. All images are (by default) scaled to a maximum size of 960px (width) X 800px (height), | ||
and auto-rotation (based on EXIF data) for JPG images is by default **on**. Please note that EXIF rotation only works | ||
if the uploaded image is larger than the specified values, and of course is present. | ||
|
||
Simply install the module. All images are (by default) scaled to a maximum size of 960px (width) X 800px (height), and auto-rotation (based on EXIF data) for JPG images is by default **on**. Please note that EXIF rotation only works if the uploaded image is larger than the specified values, and of course is present. | ||
|
||
## Configuration | ||
Create or edit a *.yml file in your mysite/_config/ folder (eg: mysite/_config/config.yml) and | ||
add & edit the following: | ||
|
||
Create or edit a *.yml file in your mysite/_config/ folder (eg: mysite/_config/config.yml) and add & edit the following: | ||
|
||
``` | ||
ScaledUploads: | ||
max-width: 960 | ||
max-height: 800 | ||
auto-rotate: 0 | ||
``` | ||
|
||
If you require larger images for a particular DataObject (such as full-page slideshows), but wish to keep all | ||
other uploads scaled to a pre-set default, you can simply add something like this to your DataObject: | ||
If you require larger images for a particular DataObject (such as full-page slideshows), but wish to keep all other uploads scaled to a pre-set default, you can simply add something like this to your DataObject: | ||
|
||
``` | ||
public function onBeforeWrite() { | ||
Config::inst()->update('ScaledUploads', 'max-width', 1600); | ||
Config::inst()->update('ScaledUploads', 'max-height', 1600); | ||
parent::onBeforeWrite(); | ||
public function onBeforeWrite() | ||
{ | ||
Config::inst()->update('ScaledUploads', 'max-width', 1600); | ||
Config::inst()->update('ScaledUploads', 'max-height', 1600); | ||
parent::onBeforeWrite(); | ||
} | ||
``` | ||
|
||
If you need to bypass (skip) ScaledUploads for any particular reason, use: | ||
|
||
``` | ||
Config::inst()->update('ScaledUploads', 'bypass', true); | ||
``` | ||
or | ||
``` | ||
ScaledUploads::$bypass = true; | ||
``` |
Empty file.
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,3 @@ | ||
# Code of conduct | ||
|
||
Any discussions about this module, issues or pull requests should be done through the Github project page. |
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,7 @@ | ||
# Installation | ||
|
||
``` | ||
composer require axllent/silverstripe-scaled-uploads | ||
``` | ||
|
||
Please refer to the [README.md](../README.md) for installation & configuration options. |