mirror of
https://github.com/mosbth/cimage.git
synced 2025-01-17 19:18:15 +01:00
Changing ppi to dpr. #25
This commit is contained in:
parent
35dd5c9064
commit
4dfbcd9784
18
CImage.php
18
CImage.php
@ -175,9 +175,9 @@ class CImage
|
||||
|
||||
|
||||
/**
|
||||
* Change target height & width when different ppi, ppi 2 means double image dimensions.
|
||||
* Change target height & width when different dpr, dpr 2 means double image dimensions.
|
||||
*/
|
||||
private $ppi = 1;
|
||||
private $dpr = 1;
|
||||
|
||||
|
||||
/**
|
||||
@ -359,7 +359,7 @@ class CImage
|
||||
|
||||
// Output format
|
||||
'outputFormat' => null,
|
||||
'ppi' => 1,
|
||||
'dpr' => 1,
|
||||
|
||||
// Options for saving
|
||||
//'quality' => null,
|
||||
@ -528,15 +528,15 @@ class CImage
|
||||
$this->log("Setting new height based on aspect ratio to {$this->newHeight}");
|
||||
}
|
||||
|
||||
// Change width & height based on ppi
|
||||
if ($this->ppi != 1) {
|
||||
// Change width & height based on dpr
|
||||
if ($this->dpr != 1) {
|
||||
if (!is_null($this->newWidth)) {
|
||||
$this->newWidth = round($this->newWidth * $this->ppi);
|
||||
$this->log("Setting new width based on ppi={$this->ppi} - w={$this->newWidth}");
|
||||
$this->newWidth = round($this->newWidth * $this->dpr);
|
||||
$this->log("Setting new width based on dpr={$this->dpr} - w={$this->newWidth}");
|
||||
}
|
||||
if (!is_null($this->newHeight)) {
|
||||
$this->newHeight = round($this->newHeight * $this->ppi);
|
||||
$this->log("Setting new height based on ppi={$this->ppi} - h={$this->newHeight}");
|
||||
$this->newHeight = round($this->newHeight * $this->dpr);
|
||||
$this->log("Setting new height based on dpr={$this->dpr} - h={$this->newHeight}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ Revision history
|
||||
|
||||
v0.5.x (latest)
|
||||
|
||||
* Adding option `ppi` which defaults to 1. Set to 2 to get a twice as large image. Useful for Retina displays. Basically a shortcut to enlarge the image.
|
||||
* Adding option `dpr, device-pixel-ratio` which defaults to 1. Set to 2 to get a twice as large image. Useful for Retina displays. Basically a shortcut to enlarge the image.
|
||||
* Adding utility `cache.bash` to ease gathering stats on cache usage. #21
|
||||
* Cache-directory can now be readonly and serve all cached files, still failing when need to save files. #5
|
||||
* Cache now uses same file extension as original image #37.
|
||||
|
@ -464,11 +464,11 @@ verbose("json = $outputFormat");
|
||||
|
||||
|
||||
/**
|
||||
* ppi - change to get larger image to easier support larger ppi, such as retina.
|
||||
* dpr - change to get larger image to easier support larger dpr, such as retina.
|
||||
*/
|
||||
$ppi = get('ppi', 1);
|
||||
$dpr = get(array('ppi', 'dpr', 'device-pixel-ratio'), 1);
|
||||
|
||||
verbose("ppi = $ppi");
|
||||
verbose("dpr = $dpr");
|
||||
|
||||
|
||||
|
||||
@ -531,7 +531,7 @@ $img->setVerbose($verbose)
|
||||
|
||||
// Output format
|
||||
'outputFormat' => $outputFormat,
|
||||
'ppi' => $ppi,
|
||||
'dpr' => $dpr,
|
||||
)
|
||||
)
|
||||
->loadImageDetails()
|
||||
|
Loading…
x
Reference in New Issue
Block a user