2013-08-06 7 views
1

Il est la première fois que im en utilisant ImageMagick bien im essayant de recadrer une image, mais le problème est que je reçois cette erreur:image culture avec ImageMagick Codeigniter

Traitement de l'image a échoué. Vérifiez que votre serveur prend en charge le protocole choisi et que le chemin d'accès à votre bibliothèque d'images est correct.

ici est mon code

$config['image_library'] = 'imagemagick'; 
$config['library_path'] = '/usr/bin'; 
$config['source_image'] ="./assets/profile_pic.jpg"; 
$config['create_thumb'] = TRUE; 
$config['maintain_ratio'] = FALSE; 
$config['x_axis'] = 300; 
$config['y_axis'] = 300; 
//$config['width'] = 650; 
//$config['height'] = 353;  
$config['new_image'] = "./assets/profile_pic.jpg"; 

$this->load->library('image_lib', $config); 
//$this->image_lib->crop(); 
$this->image_lib->initialize($config); 
if (!$this->image_lib->crop()){ 
    echo $this->image_lib->display_errors(); 
} 

Alors devrais-je télécharger ImageMagick ou quelque chose comme ça?

thx les gars!

+0

pourquoi ne pas utiliser GD2? : / – sbaaaang

Répondre

1

Ci-dessous vous avez obtenu un résultat. J'espère que vous aurez aussi le même.

$this->load->library('image_lib'); 

    //For resizing of image in size of dilog 
    $config['image_library'] = 'ImageMagick'; 
    $config['library_path'] = 'C:\\ImageMagick\\'; 

    $config['source_image'] = $source_filepath; 
    $config['new_image'] = $new_filepath; 

    $config['quality'] = '100%'; 
    $config['maintain_ratio'] = TRUE; 
    $config['x_axis'] = 26; 
    $config['y_axis'] = 54; 
    $config['width'] = 100; 
    $config['height'] = 100; 

    $this->image_lib->initialize($config); 

    if (!$this->image_lib->crop()){ 
     $error_msg = $this->image_lib->display_errors(); 
     print_r($error_msg); 
    } 
    else { 
     echo "Done"; 
    } 

Ici

$config['library_path'] = 'C:\\ImageMagick\\'; 

est le chemin pour les fenêtres où votre application ImageMagick est installé. (Essayez d'installer dans un dossier dans lequel nous pouvons facilement la carte pour le chemin de bibliothèque). Modifier la bibliothèque d'images:

$config['image_library'] = 'ImageMagick'; 

& autre toute la configuration est reste la même.

Questions connexes