<?php require '../init.inc.php'; $file = new FileUpload('pic'); //$path = $file->Get_Link_Path(); if (isset($_POST['type'])) { switch ($_POST['type']) { case 'content': $hight = 100; $width = 150; break; case 'rotatain': $hight = 193; $width = 268; } } $img = new Image($file->Get_Path()); $img->Thumb($width, $hight); $img->Out(); Tool::alertOpenerClose('上传成功', $file->Get_Link_Path());
<?php require substr(dirname(__FILE__), 0, -7) . '/init.inc.php'; if (isset($_POST['send'])) { $_fileupload = new FileUpload('pic', $_POST['MAX_FILE_SIZE']); $_path = $_fileupload->getPath(); $_img = new Image($_path); $_img->thumb(100, 100); $_img->out(); Tool::alertOpenerClose('thumbnail upload succeed', $_path); } else { Tool::alertBack('file too size'); }
break; case 'rotatain': $_width = 268; $_height = 193; $_info = '轮播图上传成功!'; break; case 'adver': switch ($_POST['size']) { case '690x80': $_width = 690; $_height = 80; $_info = '头部广告690x80上传成功!'; break; case '270x200': $_width = 270; $_height = 200; $_info = '侧栏广告270x200上传成功!'; } break; default: Tool::alertBack('警告:非法操作!'); } $_fileupload = new FileUpload('pic', $_POST['MAX_FILE_SIZE']); $_path = $_fileupload->getPath(); $_img = new Image($_path); $_img->thumb($_width, $_height); $_img->out(); Tool::alertOpenerClose($_info, $_path); } else { Tool::alertBack('警告:文件过大或者其他未知错误导致浏览器崩溃!'); }