function _imagepicker_get_bytes in Image Picker 6.2
Same name and namespace in other branches
- 5.2 imagepicker.module \_imagepicker_get_bytes()
- 7 imagepicker.functions.inc \_imagepicker_get_bytes()
1 call to _imagepicker_get_bytes()
File
- ./
imagepicker.functions.inc, line 2059 - Imagepicker functions
Code
function _imagepicker_get_bytes($img_id, $account = FALSE) {
if ($account) {
$user = $account;
$userdir = array(
'name' => $user->name,
'uid' => $user->uid,
);
}
else {
global $user;
$userdir = FALSE;
}
$tot = 0;
$img = _imagepicker_get_img($img_id, FALSE, $user);
if ($img) {
$path = imagepicker_get_path(FALSE, $userdir);
$fullinfo = image_get_info($path . $img['img_name']);
$thumbsinfo = image_get_info($path . IMAGEPICKER_THUMBS_DIR . '/' . $img['img_name']);
$browserinfo = image_get_info($path . IMAGEPICKER_BROWSER_DIR . '/' . $img['img_name']);
if (file_exists($path . IMAGEPICKER_ORIG_DIR . '/' . $img['img_name'])) {
$originfo = image_get_info($path . IMAGEPICKER_ORIG_DIR . '/' . $img['img_name']);
}
else {
$originfo = array(
'file_size' => 0,
);
}
$tot = $fullinfo['file_size'] + $thumbsinfo['file_size'] + $browserinfo['file_size'] + $originfo['file_size'];
}
else {
drupal_set_message(t('Image not found.'), 'error');
}
return $tot;
}