Hi all : ) Thank you in advance for any assistance with this question.
I am using CodeIgniter and have images uploading, rotating and resizing successfully. It is when I try to create multiple sizes fro an image that I am a little lost.
Here is my code:
// First I make two copies of the origional image - there is no problem here - these always work. I always have the successfully copied images.
$Copy_Mid_Size_File = "Some_Path_For_The_Newly_Copied_Mid_Size_Image"
if(!copy($source_image, $Copy_Mid_Size_File)){
echo "failed to copy $Copy_Mid_Size_File - Please contact the system administrator.
";
die();
}
$Copy_Thumbnail_Size_File = "Some_Path_For_The_Newly_Copied_Thumbnail_Size_Image"
if(!copy($source_image, $Copy_Thumbnail_Size_File)){
echo "failed to copy $Copy_Thumbnail_Size_File - Please contact the system administrator.
";
die();
}
// Now I resize for the mid size image
$config['image_library'] = 'imagemagick';
$config['library_path'] = '/usr/bin';
$config['source_image'] = $Copy_Mid_Size_File;
$config['maintain_ratio'] = TRUE;
$config['quality'] = '100%';
$config['master_dim'] = 'auto';
$config['width'] = 200;
$config['height'] = 200;
$this->load->library('image_lib', $config);
if(!$this->image_lib->resize()){
echo $this->image_lib->display_errors();// This has never reported an error yet
echo "Image Re-size for Mid Size Image FAILED!";// This has never reported an error yet
die();
}else{
echo" Mid-Size Re-size Worked!";
}
// Now I try to resize for the Thumbnail
$config['image_library'] = 'imagemagick';
$config['library_path'] = '/usr/bin';
$config['source_image'] = $Copy_Thumbnail_Size_File;
$config['maintain_ratio'] = TRUE;
$config['quality'] = '100%';
$config['master_dim'] = 'auto';
$config['width'] = 50;
$config['height'] = 50;
$this->load->library('image_lib', $config);
if(!$this->image_lib->resize()){
echo $this->image_lib->display_errors();// This has never reported an error yet
echo "Image Re-size for Thumbnail Size Image FAILED!";// This has never reported an error yet
die();
}else{
echo" Thumbnail Re-size Worked!";
}
I always end up with the proper number of images correctly named - The thumbnail image just does not re-size - there is no error reported. It always says that is succeeded.
If I put the thumbnail re-size code first - the thumbnail re-sizes correctly - but then the mid-size image does not.
I realize there are other ways to load the libraries - but I don't see why the first re-size works but the second does not.
Any ideas?
Thanks. Regards, Ken