Skip to content

Commit

Permalink
Updated overlay() method to accept a filename or a SimpleImage object
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed Feb 23, 2014
1 parent 1307719 commit e72906f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/abeautifulsite/SimpleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function output_base64($format = null, $quality = null) {
*
* Overlay an image on top of another, works with 24-bit PNG alpha-transparency
*
* @param string $overlay_file
* @param string $overlay An image filename or a SimpleImage object
* @param string $position center|top|left|bottom|right|top left|top right|bottom left|bottom right
* @param float|int $opacity Overlay opacity 0-1
* @param int $x_offset Horizontal offset in pixels
Expand All @@ -704,10 +704,12 @@ function output_base64($format = null, $quality = null) {
* @return SimpleImage
*
*/
function overlay($overlay_file, $position = 'center', $opacity = 1, $x_offset = 0, $y_offset = 0) {
function overlay($overlay, $position = 'center', $opacity = 1, $x_offset = 0, $y_offset = 0) {

// Load overlay image
$overlay = new SimpleImage($overlay_file);
if( !($overlay instanceof SimpleImage) ) {
$overlay = new SimpleImage($overlay);
}

// Convert opacity
$opacity = $opacity * 100;
Expand Down

0 comments on commit e72906f

Please sign in to comment.