Created
December 10, 2019 09:56
-
-
Save spham/b3610c97c02cdf3874eb9ff14ddd709c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // upload des images dans un dossiers externe a l'application | |
| public function postAction() | |
| { | |
| $config = Zend_Registry::get(Cadif_Enum_RegistryKeys::CONFIG); | |
| $dossier = $config->application->uploadCommonPath . $_POST['id_contenu']; // dossier avec numero de contenu | |
| $nom_du_fichier_recu = $_FILES["file"]['name']; | |
| $mon_fichier = $dossier . DIRECTORY_SEPARATOR . $nom_du_fichier_recu; | |
| if (!file_exists($dossier)) { | |
| mkdir($dossier, 0777, true); | |
| } | |
| if ( $nom_du_fichier_recu == "screenshot.png" ) | |
| { | |
| $img = imagecreatefrompng($_FILES['file']['tmp_name']); | |
| $croppedImage = imagecropauto($img, IMG_CROP_WHITE); | |
| imagepng($croppedImage, $mon_fichier); | |
| imagedestroy($croppedImage); | |
| return true; | |
| } | |
| move_uploaded_file($_FILES['file']['tmp_name'], $mon_fichier); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment