Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Thumbnail Loop not resizing correctly for first picture
#1

[eluser]DaTran[/eluser]
I have an array that stores the sizes of thumbnails I want, it's able to resize correctly except for the first time.

Code:
function thumb_scan($source_path) {
      // create configs
      $config = array();
      foreach ($this->thumb_scan as $size) {
        
        $config[] = array(
          'maintain_ratio' => true,
              'master_dim' => 'width',
              'width' => $size,
              'source_image' => $source_path,
              'new_image' => $this->gallery_path . '/scan/thumbs/' . $size
          );
          
      }
      print_r($config);
    foreach ($config as $item) {
      $this->image_lib->clear();
      
      print_r($this->image_lib);
      
      $this->image_lib->initialize($item);
      if(!$this->image_lib->resize()) {
        return FALSE;
      }
    }
      return TRUE;
      
    }

The forum will only allow a limited amount of characters so I've only displayed the first 2 thumbnails As you can see before initializing it's clear and when the first thumbnail is applied the width is set but the height is set WRONG it's suppose to maintain the ratio. The next thumb for size 600 sets the height correctly. Whats up with that?

This is what is print_r();

Array
(
[0] => Array
(
[maintain_ratio] => 1
[master_dim] => width
[width] => 700
[source_image] => /Users/Alex/Sites/*/images/scan/ca5b1e4b070bf8ef21f18315d7550672.jpg
[new_image] => /Users/Alex/Sites/*/images/scan/thumbs/700
)

[1] => Array
(
[maintain_ratio] => 1
[master_dim] => width
[width] => 600
[source_image] => /Users/Alex/Sites/*/images/scan/ca5b1e4b070bf8ef21f18315d7550672.jpg
[new_image] => /Users/Alex/Sites/*4/images/scan/thumbs/600
)
CI_Image_lib Object
(
[image_library] => gd2
[library_path] =>
[dynamic_output] =>
[source_image] =>
[new_image] =>
[width] =>
[height] =>
[quality] =>
[create_thumb] =>
[thumb_marker] => _thumb
[maintain_ratio] => 1
[master_dim] => auto
[rotation_angle] =>
[x_axis] =>
[y_axis] =>
[wm_text] =>
[wm_type] => text
[wm_x_transp] => 4
[wm_y_transp] => 4
[wm_overlay_path] =>
[wm_font_path] =>
[wm_font_size] =>
[wm_vrt_alignment] =>
[wm_hor_alignment] =>
[wm_padding] =>
[wm_hor_offset] =>
[wm_vrt_offset] =>
[wm_font_color] =>
[wm_shadow_color] =>
[wm_shadow_distance] =>
[wm_opacity] =>
[source_folder] =>
[dest_folder] =>
[mime_type] =>
[orig_width] =>
[orig_height] =>
[image_type] =>
[size_str] =>
[full_src_path] =>
[full_dst_path] =>
[create_fnc] =>
[copy_fnc] =>
[error_msg] => Array
(
)

[wm_use_drop_shadow] =>
[wm_use_truetype] =>
)
CI_Image_lib Object
(
[image_library] => gd2
[library_path] =>
[dynamic_output] =>
[source_image] =>
[new_image] =>
[width] => 700
[height] => 3474
[quality] =>
[create_thumb] =>
[thumb_marker] =>
[maintain_ratio] => 1
[master_dim] => auto
[rotation_angle] =>
[x_axis] =>
[y_axis] =>
[wm_text] =>
[wm_type] => text
[wm_x_transp] => 4
[wm_y_transp] => 4
[wm_overlay_path] =>
[wm_font_path] =>
[wm_font_size] =>
[wm_vrt_alignment] =>
[wm_hor_alignment] =>
[wm_padding] =>
[wm_hor_offset] =>
[wm_vrt_offset] =>
[wm_font_color] =>
[wm_shadow_color] =>
[wm_shadow_distance] =>
[wm_opacity] =>
[source_folder] =>
[dest_folder] =>
[mime_type] => image/jpeg
[orig_width] =>
[orig_height] =>
[image_type] =>
[size_str] =>
[full_src_path] =>
[full_dst_path] =>
[create_fnc] =>
[copy_fnc] =>
[error_msg] => Array
(
)

[wm_use_drop_shadow] =>
[wm_use_truetype] =>
[dest_image] => ca5b1e4b070bf8ef21f18315d7550672.jpg
)
CI_Image_lib Object
(
[image_library] => gd2
[library_path] =>
[dynamic_output] =>
[source_image] =>
[new_image] =>
[width] => 600
[height] => 391
[quality] =>
[create_thumb] =>
[thumb_marker] =>
[maintain_ratio] => 1
[master_dim] => auto
[rotation_angle] =>
[x_axis] =>
[y_axis] =>
[wm_text] =>
[wm_type] => text
[wm_x_transp] => 4
[wm_y_transp] => 4
[wm_overlay_path] =>
[wm_font_path] =>
[wm_font_size] =>
[wm_vrt_alignment] =>
[wm_hor_alignment] =>
[wm_padding] =>
[wm_hor_offset] =>
[wm_vrt_offset] =>
[wm_font_color] =>
[wm_shadow_color] =>
[wm_shadow_distance] =>
[wm_opacity] =>
[source_folder] =>
[dest_folder] =>
[mime_type] => image/jpeg
[orig_width] =>
[orig_height] =>
[image_type] =>
[size_str] =>
[full_src_path] =>
[full_dst_path] =>
[create_fnc] =>
[copy_fnc] =>
[error_msg] => Array
(
)

[wm_use_drop_shadow] =>
[wm_use_truetype] =>
[dest_image] => ca5b1e4b070bf8ef21f18315d7550672.jpg
)


Messages In This Thread
[SOLVED] Thumbnail Loop not resizing correctly for first picture - by El Forum - 12-23-2010, 02:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB