- # resize image as needed
- if($data['image'] && $data['sizes']) {
- $big_src = enc_image_src($data['image']);
- $row = explode("\n", $data['sizes']);
- foreach($row as $max_hw) {
- $max_hw = format_width_height($max_hw);
- if($max_hw == '') {
- continue;
- }
- list($max_width, $max_height) = explode('x', $max_hw);
- $src = str_replace('.', "-$max_width-$max_height.", $big_src);
- if(($_FILES['image'] && $_FILES['image']['error'] == 0) || !file_exists($src)) {
- imagemagick_convert($big_src, $src, "-geometry $max_hw", 'Resizing image');
- }
- }
- }
-