IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Object of class WebImage could not be converted to string [PHP 5.3]


Sujet :

Langage PHP

  1. #1
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Mai 2012
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations forums :
    Inscription : Mai 2012
    Messages : 6
    Points : 3
    Points
    3
    Par défaut Object of class WebImage could not be converted to string
    Bonjour,

    Je viens de migrer un site vers php 5.3.11 et j'obtiens un message d'erreur Object of class WebImage could not be converted to string.

    Voici la ligne qui génère cette erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if ($this->resize && $this->$this->crop)
    J'ai lu que depuis php 5.2, la conversion vers une chaine ne se fait plus implicitement. Mais voilà, je ne sais pas comment procéder. Si quelqu'un peut m'aider, ce serait très apprécié. Merci



    Et voici le code complet de la fonction :
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    	function convert()
    	{
    		// Cannot trim when doing resize + crop
    		if ($this->resize && $this->$this->crop)
    			$this->trim = false;
     
    		$cmd = 'convert '.escapeshellarg($this->original_path); // Source image
     
    		if (!empty($this->crop))
    		{
    			// Crop this part
    			$cmd .= escapeshellcmd(' -crop '.$this->crop_width.'x'.$this->crop_height.$this->crop_xpos.$this->crop_ypos);
    		}
     
    		if ($this->resize)
    		{
    			// Resize image to fit this size
    			$cmd .= escapeshellcmd(' -resize '.$this->resize_width.'x'.$this->resize_height);
    			if($this->resize_noenlarge)
    				$cmd .= '\>';
    		}
     
    		if ($this->cropresize)
    		{
    			// Resize to minimally fit this size, and crop the rest
    			$cmd .= escapeshellcmd(' -resize '.$this->cropresize_resizewidth.'x'.$this->cropresize_resizeheight.' -gravity center -crop '.$this->cropresize_width.'x'.$this->cropresize_height.'+0+0');	
    		}
     
    		if ($this->trim)
    			$cmd .= ' -trim + repage';	// Remove "blank" border of the image
     
    		if (!empty($this->filter))
    			$cmd .= ' -filter '.$this->filter;	// Use a filter
     
    		if ($this->sharpen > 0)
    			$cmd .= ' -unsharp 0x'.$this->sharpen;	// Use sharpening
     
    		if($this->quality >= 0)
    			$cmd .= ' -quality '.$this->quality;	// Set quality
     
    		$cmd .= ' '.escapeshellarg($this->save_dir.$this->save_file);	// Save to this file
    		$cmd .= ' && chmod 644 '.escapeshellarg($this->save_dir.$this->save_file);	// Change access rights
     
    		$this->cmd = $cmd;
     
    		$res = exec($cmd, $this->output, $return_var);
     
    		return $return_var;
    	}

  2. #2
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    $this->$this->crop

  3. #3
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Mai 2012
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations forums :
    Inscription : Mai 2012
    Messages : 6
    Points : 3
    Points
    3
    Par défaut Merci
    Merci beaucoup.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [MySQL] Object of class ArticleDao could not be converted to string
    Par Mordikkuss dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 18/01/2010, 15h49
  2. Réponses: 3
    Dernier message: 03/11/2008, 22h21
  3. Réponses: 2
    Dernier message: 14/02/2008, 17h21
  4. Réponses: 1
    Dernier message: 14/01/2008, 17h41
  5. [PEAR] Sigma: "Object of class PEAR_Error could not be converted to string"
    Par onet dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 04/09/2007, 14h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo