0
Je fiddeling avec PHP et je suis à elle depuis si longtemps je ne vois vraiment pas ce que je fais mal ici ..PHP - jpg/gif png
Quelqu'un peut me aider et Dites-moi pourquoi l'image convertie n'est pas enregistrée, alors que le fichier téléchargé est bien sauvegardé (et, BTW, ne sera pas supprimé)?
$destination_path = getcwd().DIRECTORY_SEPARATOR."img".DIRECTORY_SEPARATOR."blog".DIRECTORY_SEPARATOR."uploads".DIRECTORY_SEPARATOR;
$result = 0;
$ext = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
$target_path = $destination_path . $this->input->post("postId") . ".";
if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path . $ext)) {
switch ($ext) {
case ".jpg": case ".jpeg":
$image = imagecreatefromjpeg($target_path . $ext);
imagepng($image, $target_path . "png");
imagedestroy($image);
break;
case "gif":
$image = imagecreatefromgif($target_path . $ext);
imagepng($image, $target_path . "png");
imagedestroy($image);
break;
default:
break;
}
$result = 1;
}
Merci! Cela arrive à la fin de la journée .. – PitchBlackCat