-
Notifications
You must be signed in to change notification settings - Fork 13
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
1 parent
94962d1
commit 4d71925
Showing
19 changed files
with
605 additions
and
914 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 @@ | ||
/vendor/ |
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,29 @@ | ||
{ | ||
"name": "org_heigl/ghostscript", | ||
"description": "A PHP-Wrapper around the Ghostscript-CLI", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Andreas Heigl", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload" : { | ||
"psr-4" : { | ||
"Org_Heigl\\Ghostscript\\" : "src/" | ||
} | ||
}, | ||
"autoload-dev" : { | ||
"psr-4" : { | ||
"Org_Heigl\\GhostscriptTest\\" : "tests/" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.8||^5.3", | ||
"fabpot/php-cs-fixer": "^1.11" | ||
}, | ||
"scripts" : { | ||
"csfix" : "./vendor/bin/php-cs-fixer fix . --level=psr2" | ||
} | ||
} |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="./vendor/autoload.php"> | ||
<testsuite name="Org_Heigl\Ghostscript Test-Suite"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
|
||
<groups> | ||
<exclude> | ||
<group>disable</group> | ||
</exclude> | ||
</groups> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<!-- | ||
Adapt these paths to your special needs | ||
--> | ||
<log type="coverage-html" target="build/phpunit/coverage" charset="UTF-8" | ||
yui="true" highlight="false" | ||
lowUpperBound="35" highLowerBound="70"/> | ||
</logging> | ||
</phpunit> |
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,8 +1,6 @@ | ||
<?php | ||
/** | ||
* $Id$ | ||
* | ||
* Copyright (c) 2008-2009 Andreas Heigl<[email protected]> | ||
* Copyright (c) Andreas Heigl<[email protected]> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -22,51 +20,40 @@ | |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @category Org_Heigl | ||
* @package Org_Heigl_Ghostscript | ||
* @subpackage Devices | ||
* @author Andreas Heigl <[email protected]> | ||
* @copyright 2008-2009 Andreas Heigl | ||
* @copyright Andreas Heigl | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT-License | ||
* @version SVN: $Revision$ | ||
* @since 04.06.2009 | ||
*/ | ||
|
||
namespace Org_Heigl\Ghostscript\Device; | ||
|
||
/** | ||
* This abstract class defines interfaces for Ghostscript devices | ||
* | ||
* @category Org_Heigl | ||
* @package Org_Heigl_Ghostscript | ||
* @subpackage Devices | ||
* @author Andreas Heigl <[email protected]> | ||
* @copyright 2008-2009 Andreas Heigl | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT-License | ||
* @version SVN: $Revision$ | ||
* @since 04.06.2009 | ||
*/ | ||
abstract class Org_Heigl_Ghostscript_Device_Abstract | ||
interface DeviceInterface | ||
{ | ||
/** | ||
* Get the name of the device as Ghostscript expects it | ||
* | ||
* @return string | ||
*/ | ||
abstract public function getDevice (); | ||
public function getDevice(); | ||
|
||
/** | ||
* Get the complete parameter string for this device | ||
* | ||
* @return string | ||
*/ | ||
public function getParameterString () { | ||
return ''; | ||
} | ||
public function getParameterString(); | ||
|
||
/** | ||
* Get the ending of the file | ||
* | ||
* @return string | ||
*/ | ||
abstract function getFileEnding (); | ||
|
||
} | ||
public function getFileEnding(); | ||
} |
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,8 +1,6 @@ | ||
<?php | ||
/** | ||
* $Id$ | ||
* | ||
* Copyright (c) 2008-2009 Andreas Heigl<[email protected]> | ||
* Copyright (c) Andreas Heigl<[email protected]> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -22,39 +20,37 @@ | |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @category Org_Heigl | ||
* @package Org_Heigl_Ghostscript | ||
* @subpackage Devices | ||
* @author Andreas Heigl <[email protected]> | ||
* @copyright 2008-2009 Andreas Heigl | ||
* @copyright Andreas Heigl | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT-License | ||
* @version SVN: $Revision$ | ||
* @since 04.06.2009 | ||
*/ | ||
|
||
/** Org_Heigl_Ghostscript_Device_Abstract */ | ||
require_once 'Org/Heigl/Ghostscript/Device/Abstract.php'; | ||
|
||
namespace Org_Heigl\Ghostscript\Device; | ||
|
||
/** | ||
* This abstract class defines interfaces for Ghostscript devices | ||
* | ||
* @category Org_Heigl | ||
* @package Org_Heigl_Ghostscript | ||
* @subpackage Devices | ||
* @author Andreas Heigl <[email protected]> | ||
* @copyright 2008-2009 Andreas Heigl | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT-License | ||
* @version SVN: $Revision$ | ||
* @since 04.06.2009 | ||
*/ | ||
class Org_Heigl_Ghostscript_Device_Jpeg extends Org_Heigl_Ghostscript_Device_Abstract | ||
class Jpeg implements DeviceInterface | ||
{ | ||
/** | ||
* The quality of the JPEG | ||
* | ||
* @var int $_quality | ||
*/ | ||
protected $_quality = 75; | ||
|
||
/** | ||
* Get the name of the device as Ghostscript expects it | ||
* | ||
* @return string | ||
*/ | ||
public function getDevice () { | ||
public function getDevice() | ||
{ | ||
return 'jpeg'; | ||
} | ||
|
||
|
@@ -63,11 +59,12 @@ public function getDevice () { | |
* | ||
* @return string | ||
*/ | ||
public function getParameterString () { | ||
public function getParameterString() | ||
{ | ||
$string = ''; | ||
$string .= ' -sDEVICE=' . $this -> getDevice (); | ||
$string .= ' -dJPEGQ=' . $this -> getQuality (); | ||
$string .= ' -dQFactor=' . 1 / 100 * $this -> getQuality (); | ||
$string .= ' -sDEVICE=' . $this -> getDevice(); | ||
$string .= ' -dJPEGQ=' . $this -> getQuality(); | ||
$string .= ' -dQFactor=' . 1 / 100 * $this -> getQuality(); | ||
|
||
return $string; | ||
} | ||
|
@@ -79,16 +76,17 @@ public function getParameterString () { | |
* | ||
* @param int $quality | ||
* | ||
* @return Org_Heigl_Ghostscript_Device_Jpeg | ||
* @return Jpeg | ||
*/ | ||
public function setQuality ( $quality ) { | ||
public function setQuality($quality) | ||
{ | ||
$quality = (int) $quality; | ||
|
||
if ( 100 < $quality ) { | ||
if (100 < $quality) { | ||
$quality = 100; | ||
} | ||
|
||
if ( 0 > $quality ) { | ||
if (0 > $quality) { | ||
$quality = 0; | ||
} | ||
|
||
|
@@ -102,23 +100,18 @@ public function setQuality ( $quality ) { | |
* | ||
* @return int | ||
*/ | ||
public function getQuality () { | ||
public function getQuality() | ||
{ | ||
return $this -> _quality; | ||
} | ||
|
||
/** | ||
* The quality of the JPEG | ||
* | ||
* @var int $_quality | ||
*/ | ||
protected $_quality = 75; | ||
|
||
/** | ||
* Get the file ending | ||
* | ||
* @return string | ||
*/ | ||
public function getFileEnding () { | ||
public function getFileEnding() | ||
{ | ||
return 'jpeg'; | ||
} | ||
} | ||
} |
Oops, something went wrong.