本文整理汇总了PHP中PageController::compress_image方法的典型用法代码示例。如果您正苦于以下问题:PHP PageController::compress_image方法的具体用法?PHP PageController::compress_image怎么用?PHP PageController::compress_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageController
的用法示例。
在下文中一共展示了PageController::compress_image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadTrombi
/**
* Uploads a group photo to the database.
**/
public function uploadTrombi()
{
$accountmodel = new AccountModel();
$PageController = new PageController();
//$accountView = new AccountView();
$erreur = 0;
if (isset($_FILES['student_trombi'])) {
$maxsize = 2097152;
$extensions_valides = array('png', 'jpg', 'jpeg');
$filename = $_FILES['student_trombi']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$extension_upload = strtolower(substr(strrchr($_FILES['student_trombi']['name'], '.'), 1));
if ($_FILES['student_trombi']['error'] > 0) {
//echo 'error';
//$erreur += 1;
} else {
if ($_FILES['student_trombi']['size'] >= $maxsize || $_FILES["student_trombi"]["size"] == 0) {
//$accountView -> showMessage("Le poids de la photo du trombinoscope est trop grosse (max : 2 Mo).");
echo 'erreur size';
$erreur += 1;
} else {
if (!in_array($ext, $extensions_valides)) {
//$accountView -> showMessage("Mauvaise extension pour la photo du trombinoscope.");
echo 'erreur extension';
$erreur += 1;
} else {
$fichier = '../../img/trombi/' . $_SESSION['infoStudent']['student_id'] . ".{$extension_upload}";
if ($_SESSION['infoStudent']['student_trombi'] != "../../img/avatar.png") {
unlink($_SESSION['infoStudent']['student_trombi']);
}
var_dump($_SESSION['infoStudent']['student_trombi']);
$session = $_SESSION['infoUser']['user_id'];
$resultat = move_uploaded_file($_FILES['student_trombi']['tmp_name'], $fichier);
if ($resultat) {
$accountmodel->addTrombi($fichier, $session);
$_SESSION['infoStudent']['student_trombi'] = $fichier;
if ($extension_upload !== 'gif') {
$PageController->compress_image($fichier, $fichier, 50);
}
}
}
}
}
}
return $erreur;
}