本文整理汇总了PHP中uploader::getCallback方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::getCallback方法的具体用法?PHP uploader::getCallback怎么用?PHP uploader::getCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::getCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePreview
function updatePreview($file_id, $resource)
{
$objResponse =& new xajaxResponse();
$CFile = new CFile($file_id);
$path_file = $CFile->path . 'sm_' . $CFile->name;
if ($CFile->image_size['height'] > portfolio::PREVIEW_MAX_HEIGHT || $CFile->image_size['width'] > portfolio::PREVIEW_MAX_WIDTH) {
$CFile = $CFile->resizeImage($path_file, portfolio::PREVIEW_MAX_WIDTH, portfolio::PREVIEW_MAX_HEIGHT, 'auto', true);
} else {
$CFile = uploader::remoteCopy($CFile->id, $CFile->table, $CFile->path, false, 'sm_f_');
}
uploader::sclear($resource);
// Чистим заменяем
uploader::screateFile($CFile, $resource);
$callback = uploader::getCallback(uploader::sgetTypeUpload($resource));
$template = uploader::getTemplate('uploader.file', 'portfolio/');
$template = str_replace(array('{idFile}', '{fileName}'), array($CFile->id, $CFile->original_name), $template);
$objResponse->script("\n \$\$('#work_preview_file .qq-upload-list').set('html', '{$template}');\n \$\$('#work_preview_file .qq-upload-list .qq-upload-file').set('href', '" . WDCPREFIX . "/{$path_file}');\n \$\$('#work_preview_file .qq-upload-list .qq-uploader-fileID').show();\n ");
$objResponse->script("\n \$\$('#work_preview_file .qq-upload-delete').addEvent('click', function() {\n new Request.JSON({\n url: '/uploader.php',\n onSuccess: function(resp) {\n if(resp.success) {\n \$\$('#work_preview_file .qq-upload-list').set('html', '');\n if(resp.onComplete !== undefined) {\n eval(resp.onComplete);\n }\n } \n }\n }).post({\n 'action': 'remove',\n 'files' : [{$CFile->id}],\n 'resource': '{$resource}',\n 'u_token_key': '{$_SESSION['rand']}'\n });\n });\n ");
$objResponse->script($callback);
return $objResponse;
}