本文整理匯總了PHP中Tool::redimage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tool::redimage方法的具體用法?PHP Tool::redimage怎麽用?PHP Tool::redimage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tool
的用法示例。
在下文中一共展示了Tool::redimage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: configureData
public function configureData()
{
if (!Tool::isOk($_POST['id']) || !($user = Model_User::getLoggedUser()) || $user->getId() != $_POST['id'] || !Tool::isOk($_POST['zip']) || !isset($_POST['gender']) || !Tool::isOk($_POST['login'])) {
header('Location: ' . Conf::get('ROOT_PATH'));
exit;
}
DB::update('UPDATE `user` SET
`zip`="' . $_POST['zip'] . '",
`male`="' . $_POST['gender'] . '"
WHERE `id`="' . $_POST['id'] . '"');
if (isset($_FILES) && isset($_FILES['avatar']) && $_FILES['avatar']['error'] != 4) {
$size = filesize($_FILES['avatar']['tmp_name']);
$stat = stat($_FILES['avatar']['tmp_name']);
if ($size[0] <= 1680 && $size[1] <= 1680 && $stat['size'] <= 450 * 1024) {
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['avatar']['name']));
$original = Conf::get('MEDIA_DIR') . 'avatar/original/' . $_POST['id'] . '.' . $extention;
move_uploaded_file($_FILES['avatar']['tmp_name'], $original);
$sizeSmall = explode('x', Conf::get('AVATAR_SMALL_SIZE'));
$sizeMedium = explode('x', Conf::get('AVATAR_MEDIUM_SIZE'));
$sizeLarge = explode('x', Conf::get('AVATAR_LARGE_SIZE'));
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_LARGE_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeLarge[0], isset($sizeLarge[1]) ? $sizeLarge[1] : false, true);
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_MEDIUM_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeMedium[0], isset($sizeMedium[1]) ? $sizeMedium[1] : false, true);
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_SMALL_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeSmall[0], isset($sizeSmall[1]) ? $sizeSmall[1] : false, true);
}
}
$_SESSION['feedback'] = 'Your informations has been updated';
header('Location: ' . Conf::get('ROOT_PATH') . $_POST['login']);
}
示例2: header
<?php
header('Content-Type: application/json; charset=utf-8');
header("Cache-Control: no-cache");
set_time_limit(120);
ini_set("memory_limit", '512M');
if (isset($_FILES) && isset($_FILES['Filedata'])) {
echo '2';
$size = filesize($_FILES['Filedata']['tmp_name']);
$stat = stat($_FILES['Filedata']['tmp_name']);
if ($size[0] <= 2048 && $size[1] <= 2048 && $stat['size'] <= 2000 * 1024) {
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['Filedata']['name']));
$original = Conf::get('MEDIA_DIR') . 'question/original/' . $_POST['id'] . '.' . $extention;
move_uploaded_file($_FILES['Filedata']['tmp_name'], $original);
$sizeMedium = explode('x', Conf::get('QUESTION_MEDIUM_SIZE'));
Tool::redimage($original, Conf::get('MEDIA_DIR') . 'question/315x145/' . $_POST['id'] . '.jpg', $sizeMedium[0], isset($sizeMedium[1]) ? $sizeMedium[1] : false, true);
Tool::redimage($original, Conf::get('ROOT_DIR') . 'backoffice/image/preview/question_' . $_POST['id'] . '.jpg', 120, 55, true);
echo '1';
}
}
echo '3';
示例3: header
<?php
if (!Tool::isOk($_POST['id']) || !Tool::isOk($_SESSION['user']) || $_SESSION['user']['id'] != $_POST['id'] || !Tool::isOk($_POST['login'])) {
header('Location: ' . Conf::get('ROOT_PATH'));
exit;
}
if (isset($_FILES) && isset($_FILES['avatar']) && $_FILES['avatar']['error'] != 4) {
$size = filesize($_FILES['avatar']['tmp_name']);
$stat = stat($_FILES['avatar']['tmp_name']);
if ($size[0] <= 1680 && $size[1] <= 1680 && $stat['size'] <= 450 * 1024) {
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['avatar']['name']));
$original = Conf::get('ROOT_DIR') . 'media/avatar/original/' . $_POST['id'] . '.' . $extention;
move_uploaded_file($_FILES['avatar']['tmp_name'], $original);
$sizeSmall = explode('x', Conf::get('AVATAR_SMALL_SIZE'));
$sizeMedium = explode('x', Conf::get('AVATAR_MEDIUM_SIZE'));
$sizeLarge = explode('x', Conf::get('AVATAR_LARGE_SIZE'));
Tool::redimage($original, Conf::get('ROOT_DIR') . 'media/avatar/140x140/' . $_POST['id'] . '.jpg', $sizeLarge[0], isset($sizeLarge[1]) ? $sizeLarge[1] : false, true);
Tool::redimage($original, Conf::get('ROOT_DIR') . 'media/avatar/80x80/' . $_POST['id'] . '.jpg', $sizeMedium[0], isset($sizeMedium[1]) ? $sizeMedium[1] : false, true);
Tool::redimage($original, Conf::get('ROOT_DIR') . 'media/avatar/25x25/' . $_POST['id'] . '.jpg', $sizeSmall[0], isset($sizeSmall[1]) ? $sizeSmall[1] : false, true);
}
}
$_SESSION['feedback'] = 'Your informations has been updated';
header('Location: ' . Conf::get('ROOT_PATH') . $_POST['login']);