Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncphp
/
mcClasses
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d58c99e3
authored
Apr 29, 2014
by
sn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Imagick
1 parent
0483f85c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
0 deletions
file/class_mcFile.inc.php
file/class_mcImagick.inc.php
include.php
file/class_mcFile.inc.php
View file @
d58c99e
...
...
@@ -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
;
}
}
?>
file/class_mcImagick.inc.php
0 → 100644
View file @
d58c99e
<?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
include.php
View file @
d58c99e
...
...
@@ -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_mcCairoSvg.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_mcCsv.inc.php'
;
require_once
$__PATH_to_mcClasses
.
'class_mcDeprecated.inc.php'
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment