@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | $explode = explode("/", $this->chemin_image); |
| 59 | 59 | $this->image = end($explode); |
| 60 | 60 | return $this->image; |
| 61 | - } |
|
| 62 | - else { |
|
| 61 | + } else { |
|
| 63 | 62 | $this->erreur = "Impossible de trouver votre image, vuellez réessayer dans un instant"; |
| 64 | 63 | return false; |
| 65 | 64 | } |
@@ -87,8 +86,7 @@ discard block |
||
| 87 | 86 | if ((empty($_FILES[$name]['name'])) && ($autorize_empty == 0)) { |
| 88 | 87 | $this->erreur = "Vous devez obligatoirement ajouter une image"; |
| 89 | 88 | return false; |
| 90 | - } |
|
| 91 | - else { |
|
| 89 | + } else { |
|
| 92 | 90 | //test si il y a deja une img |
| 93 | 91 | if ($old_image_req != null) { |
| 94 | 92 | $query = $dbc->query($old_image_req); |
@@ -106,12 +104,10 @@ discard block |
||
| 106 | 104 | if (!in_array(substr($image, -3), $this->autorized_extention)) { |
| 107 | 105 | $this->erreur = "Votre image ne comporte pas l'extension jpg, png, jpeg, gif, JPG, PNG, JPEG, GIF"; |
| 108 | 106 | return false; |
| 109 | - } |
|
| 110 | - else if (($infos_img[0] >= $this->width_max) && ($infos_img[1] >= $this->height_max) && ($_FILES[$name]['size'] >= $this->poid_max)) { |
|
| 107 | + } else if (($infos_img[0] >= $this->width_max) && ($infos_img[1] >= $this->height_max) && ($_FILES[$name]['size'] >= $this->poid_max)) { |
|
| 111 | 108 | $this->erreur = "Problème dans les dimensions ou taille de l'image."; |
| 112 | 109 | return false; |
| 113 | - } |
|
| 114 | - else if (move_uploaded_file($_FILES[$name]['tmp_name'], $this->dossier_image."/".$uniqid.substr($image, -4))) { |
|
| 110 | + } else if (move_uploaded_file($_FILES[$name]['tmp_name'], $this->dossier_image."/".$uniqid.substr($image, -4))) { |
|
| 115 | 111 | $imageok = $uniqid.substr($image, -4); |
| 116 | 112 | |
| 117 | 113 | $urlimg = $this->dossier_image."/$imageok"; |
@@ -123,8 +119,7 @@ discard block |
||
| 123 | 119 | } |
| 124 | 120 | |
| 125 | 121 | return true; |
| 126 | - } |
|
| 127 | - else { |
|
| 122 | + } else { |
|
| 128 | 123 | $this->erreur = "Impossible d'envoyer votre image sur le serveur, veuillez réessayer dans une instant, si l'erreur se reproduit, contactez votre administrateur"; |
| 129 | 124 | } |
| 130 | 125 | } |
@@ -149,8 +144,7 @@ discard block |
||
| 149 | 144 | $resize->saveImage($this->dossier_image."/".$img_resize, 100); |
| 150 | 145 | |
| 151 | 146 | $this->nom_image = $img_resize; |
| 152 | - } |
|
| 153 | - else { |
|
| 147 | + } else { |
|
| 154 | 148 | $this->nom_image = null; |
| 155 | 149 | } |
| 156 | 150 | |
@@ -174,8 +168,7 @@ discard block |
||
| 174 | 168 | unlink($this->dossier_image."/".end($old_image)); |
| 175 | 169 | return true; |
| 176 | 170 | } |
| 177 | - } |
|
| 178 | - else if ($nom_image !== null) { |
|
| 171 | + } else if ($nom_image !== null) { |
|
| 179 | 172 | $success = false; |
| 180 | 173 | |
| 181 | 174 | if (is_array($nom_image)) { |
@@ -185,32 +178,26 @@ discard block |
||
| 185 | 178 | |
| 186 | 179 | if (unlink($chemin_img)) { |
| 187 | 180 | $success = true; |
| 188 | - } |
|
| 189 | - else if (unlink($this->chemin_image)) { |
|
| 181 | + } else if (unlink($this->chemin_image)) { |
|
| 190 | 182 | $success = true; |
| 191 | - } |
|
| 192 | - else { |
|
| 183 | + } else { |
|
| 193 | 184 | $this->erreur = "Impossible de supprimer cette image, veuillez réesayer dans un instant, sinon contacter l'administrateur de votre site"; |
| 194 | 185 | $success = false; |
| 195 | 186 | } |
| 196 | 187 | } |
| 197 | - } |
|
| 198 | - else { |
|
| 188 | + } else { |
|
| 199 | 189 | if (unlink($this->dossier_image."/".$nom_image)) { |
| 200 | 190 | $success = true; |
| 201 | - } |
|
| 202 | - else if (unlink($this->chemin_image)) { |
|
| 191 | + } else if (unlink($this->chemin_image)) { |
|
| 203 | 192 | $success = true; |
| 204 | - } |
|
| 205 | - else { |
|
| 193 | + } else { |
|
| 206 | 194 | $this->erreur = "Impossible de supprimer cette image, veuillez réesayer dans un instant, sinon contacter l'administrateur de votre site"; |
| 207 | 195 | $success = false; |
| 208 | 196 | } |
| 209 | 197 | } |
| 210 | 198 | |
| 211 | 199 | return $success; |
| 212 | - } |
|
| 213 | - else { |
|
| 200 | + } else { |
|
| 214 | 201 | $this->erreur = "Impossible de supprimer cette image"; |
| 215 | 202 | return false; |
| 216 | 203 | } |