function imagepicker_uploadprogress_callback in Image Picker 7
Same name and namespace in other branches
- 6.2 imagepicker.functions.inc \imagepicker_uploadprogress_callback()
callback for uploadprogress information function.
1 string reference to 'imagepicker_uploadprogress_callback'
- imagepicker_menu in ./
imagepicker.module - Implement hook_menu().
File
- ./
imagepicker.functions.inc, line 3027 - @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function imagepicker_uploadprogress_callback($progress_key = '') {
if (!$progress_key) {
$progress_key = $_GET['key'];
}
if (imagepicker_variable_get('imagepicker_uploadprogress_server', '') && function_exists('uploadprogress_get_info') && $progress_key) {
$status = uploadprogress_get_info($progress_key);
if ($status['bytes_total']) {
$status['status'] = 1;
$status['percentage'] = round($status['bytes_uploaded'] / $status['bytes_total'] * 100, 0);
$eta = sprintf("%02d:%02d", $status['est_sec'] / 60, $status['est_sec'] % 60);
$speed = _imagepicker_bkmg($status['speed_average']);
$bytes_total = _imagepicker_bkmg($status['bytes_total']);
$status['message'] = t('Filesize: !bytes_total. !eta left at !speed/sec.', array(
'!eta' => $eta,
'!speed' => $speed,
'!bytes_total' => $bytes_total,
));
}
else {
$status['status'] = 1;
$status['percentage'] = -1;
$status['message'] = imagepicker_variable_get('imagepicker_upload_progress_message', t('Processing form... please wait.'));
}
echo json_encode($status);
}
exit;
}