Commit d58c99e3 by sn

Imagick

1 parent 0483f85c
...@@ -152,6 +152,80 @@ class mcFile { ...@@ -152,6 +152,80 @@ class mcFile {
} }
/**
* @see http://www.selfphp.info/kochbuch/kochbuch.php?code=61
*
* @param type $size
* @param type $praefix
* @param type $short
* @return string
*/
function binary_multiples($size, $praefix=true, $short= true)
{
if($praefix === true)
{
if($short === true)
{
$norm = array('B', 'kB', 'MB', 'GB', 'TB', 'PB',
'EB', 'ZB', 'YB');
}
else
{
$norm = array('Byte',
'Kilobyte',
'Megabyte',
'Gigabyte',
'Terabyte',
'Petabyte',
'Exabyte',
'Zettabyte',
'Yottabyte'
);
}
$factor = 1000;
}
else
{
if($short === true)
{
$norm = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB',
'EiB', 'ZiB', 'YiB');
}
else
{
$norm = array('Byte',
'Kibibyte',
'Mebibyte',
'Gibibyte',
'Tebibyte',
'Pebibyte',
'Exbibyte',
'Zebibyte',
'Yobibyte'
);
}
$factor = 1024;
}
$count = count($norm) -1;
$x = 0;
while ($size >= $factor && $x < $count)
{
$size /= $factor;
$x++;
}
$size = sprintf("%01.2f", $size) . ' ' . $norm[$x];
return $size;
}
} }
?> ?>
<?php
class mcImagick {
private static $files = array();
public static function getData($param_file_path) {
if(file_exists($param_file_path)) {
$ncimage_Imagick = new Imagick($param_file_path);
$ncimage_data = array(
'height' => $ncimage_Imagick->getImageHeight(),
'width' => $ncimage_Imagick->getImageWidth(),
'properties' => $ncimage_Imagick->getImageProperties(),
'size' => $ncimage_Imagick->getImageSize(),
'type' => $ncimage_Imagick->getImageType(),
);
return $ncimage_data;
}
}
}
\ No newline at end of file
...@@ -31,6 +31,7 @@ require_once $__PATH_to_mcClasses . 'file/class_mcSvg.inc.php'; ...@@ -31,6 +31,7 @@ require_once $__PATH_to_mcClasses . 'file/class_mcSvg.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcInkscape.inc.php'; require_once $__PATH_to_mcClasses . 'file/class_mcInkscape.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcCairoSvg.inc.php'; require_once $__PATH_to_mcClasses . 'file/class_mcCairoSvg.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcImage.inc.php'; require_once $__PATH_to_mcClasses . 'file/class_mcImage.inc.php';
require_once $__PATH_to_mcClasses . 'file/class_mcImagick.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcCONST.inc.php'; require_once $__PATH_to_mcClasses . 'class_mcCONST.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcCsv.inc.php'; require_once $__PATH_to_mcClasses . 'class_mcCsv.inc.php';
require_once $__PATH_to_mcClasses . 'class_mcDeprecated.inc.php'; require_once $__PATH_to_mcClasses . 'class_mcDeprecated.inc.php';
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!