Bonjour,
J'ai une méthode définie dans une variable et je n'arrive pas à l'utiliser.
Partie utile du code:La ligne 26 provoque une erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 private $imageCreateFunc; private function setFunctions() { switch ($this->mime) { case 'image/jpeg': $imageCreateFunc = 'imagecreatefromjpeg'; break; case 'image/png': $imageCreateFunc = 'imagecreatefrompng'; break; case 'image/gif': $imageCreateFunc = 'imagecreatefromgif'; break; default: throw new Exception('Unknown image type'); } $this->imageCreateFunc = $imageCreateFunc; } public function save(){ // ... du code ... $image = $this->imageCreateFunc($this->targetPath); // ... du code ... }J'ai essayé de remplacer la ligne 21 par celle-ci $this->imageCreateFunc = '\\'.$imageCreateFunc; mais j'ai toujours la même erreur.Call to undefined method ImageResize\ImageResize::imageCreateFunc()
Partager