Welcome Guest, Not a member yet? Register   Sign In
Problem with creating thumb image Codeigniter
#1

[eluser]Unknown[/eluser]
Hello! There is my function:
Code:
<? function resize_image($path, $path_image)
   {
       $CI = & get_instance();

       $config = array();

       $config['image_library'] = 'ImageMagick';
       $config['source_image'] = $path; //full path
       $config['new_image'] = $path_image.'new_image.jpg';
       $config['create_thumb'] = TRUE; // ставим флаг создания эскиза
       $config['maintain_ratio'] = TRUE; // сохранять пропорции
       $config['width']     = 200; // и задаем размеры
       $config['height']   = 200;

       $CI->load->library('image_lib');
       $CI->image_lib->initialize($config);

           if ( ! $CI->image_lib->resize())
           {
               echo $CI->image_lib->display_errors();
               die();
           }
           $CI->image_lib->clear();



   }?>

I try to make thumb image by library ImageMagick, but i get error:
The path to your image library is not correct. Please set the correct path in your image preferences.
How fix it?
#2

[eluser]jairoh_[/eluser]
try echoing the path maybe it's not right.
#3

[eluser]TheFuzzy0ne[/eluser]
Do you have ImageMagick installed? I suspect you don't, in which case you should use the GD2 library.
#4

[eluser]oliwin[/eluser]
[quote author="jairoh_" date="1367921684"]try echoing the path maybe it's not right.[/quote]
Where i can set path to library?
#5

[eluser]oliwin[/eluser]
[quote author="TheFuzzy0ne" date="1367934269"]Do you have ImageMagick installed? I suspect you don't, in which case you should use the GD2 library.[/quote]
Yes, it is installed!
#6

[eluser]Suhas nazir[/eluser]
Try absolute url in place of relative

eg ;use url like this http::/domain.com/images/

instead of ../images/

#7

[eluser]TheFuzzy0ne[/eluser]
You'll need to find out where it is on your system, then you can set it with:
Code:
$this->image_lib->library_path = 'path/to/ImageMagick';
#8

[eluser]TheFuzzy0ne[/eluser]
Alternatively, you can add it to your PATH environment variable if you're running Windows, or create a shortcut to ImageMagick in your /bin directory on Linux or Mac. That way it should ensure compatibility with you production server, which probably won't require the full path, and may actually have the ImageMagick executable somewhere else.




Theme © iAndrew 2016 - Forum software by © MyBB