$list_option_base_itme_imgwidth[$i] and $temp_sum_h > $list_option_base_itme_imgheight[$i]){ //縦横が指定サイズより大きい場合 $size_w_by = $temp_sum_w/$list_option_base_itme_imgwidth[$i]; $size_h_by = $temp_sum_h/$list_option_base_itme_imgheight[$i]; //比率の大きい数字を基準 if($size_w_by > $size_h_by){ //横が大きい $size_by = $size_w_by; }else{ //縦が大きい $size_by = $size_h_by; } }elseif($temp_sum_w > $list_option_base_itme_imgwidth[$i]){ //横が大きい場合 $size_by = $temp_sum_w/$list_option_base_itme_imgwidth[$i]; }elseif($temp_sum_h > $list_option_base_itme_imgheight[$i]){ //横が大きい場合 $size_by = $temp_sum_h/$list_option_base_itme_imgheight[$i]; }else{ $size_by = 1; } }elseif(empty($list_option_base_itme_imgwidth[$i]) and !empty($list_option_base_itme_imgheight[$i])){ //画像サイズ横指定 if($temp_sum_w > $list_option_base_itme_imgwidth[$i]){ //横が大きい場合 $size_by = $temp_sum_w/$list_option_base_itme_imgwidth[$i]; }else{ $size_by = 1; } }elseif(!empty($list_option_base_itme_imgwidth[$i]) and empty($list_option_base_itme_imgheight[$i])){ //画像サイズ縦指定 if($temp_sum_h > $list_option_base_itme_imgheight[$i]){ //横が大きい場合 $size_by = $temp_sum_h/$list_option_base_itme_imgheight[$i]; }else{ $size_by = 1; } }else{ $size_by = 1; } //画像作成保存 $newsize_w = (int)($temp_sum_w/$size_by); $newsize_h = (int)($temp_sum_h/$size_by); $srcimgfile = imagecreatefromjpeg($temp_sum); $newimgfile = imagecreatetruecolor($newsize_w,$newsize_h); imagecopyresampled($newimgfile,$srcimgfile,0,0,0,0,$newsize_w,$newsize_h,$temp_sum_w,$temp_sum_h); //指定画像サイズで保存 imagejpeg($newimgfile,"../img/item/".$list_item_list_id."/i".$i.".jpg"); imagedestroy($newimgfile); imagedestroy($srcimgfile); /* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */ //サムネイルの作成 if(!empty($list_option_base_itme_sumimgwidth[$i]) and !empty($list_option_base_itme_sumimgheight[$i])){ //画像サイズ縦横指定 if($temp_sum_w > $list_option_base_itme_sumimgwidth[$i] and $temp_sum_h > $list_option_base_itme_sumimgheight[$i]){ //縦横が指定サイズより大きい場合 $size_w_by = $temp_sum_w/$list_option_base_itme_sumimgwidth[$i]; $size_h_by = $temp_sum_h/$list_option_base_itme_sumimgheight[$i]; //比率の大きい数字を基準 if($size_w_by > $size_h_by){ //横が大きい $size_by = $size_w_by; }else{ //縦が大きい $size_by = $size_h_by; } }elseif($temp_sum_w > $list_option_base_itme_sumimgwidth[$i]){ //横が大きい場合 $size_by = $temp_sum_w/$list_option_base_itme_sumimgwidth[$i]; }elseif($temp_sum_h > $list_option_base_itme_sumimgheight[$i]){ //横が大きい場合 $size_by = $temp_sum_h/$list_option_base_itme_sumimgheight[$i]; }else{ $size_by = 1; } }elseif(empty($list_option_base_itme_sumimgwidth[$i]) and !empty($list_option_base_itme_sumimgheight[$i])){ //画像サイズ横指定 if($temp_sum_w > $list_option_base_itme_sumimgwidth[$i]){ //横が大きい場合 $size_by = $temp_sum_w/$list_option_base_itme_sumimgwidth[$i]; }else{ $size_by = 1; } }elseif(!empty($list_option_base_itme_sumimgwidth[$i]) and empty($list_option_base_itme_sumimgheight[$i])){ //画像サイズ縦指定 if($temp_sum_h > $list_option_base_itme_sumimgheight[$i]){ //横が大きい場合 $size_by = $temp_sum_h/$list_option_base_itme_sumimgheight[$i]; }else{ $size_by = 1; } }else{ $size_by = 0; } //サムネイル画像保存 if($size_by > 0){ $newsize_w = (int)($temp_sum_w/$size_by); $newsize_h = (int)($temp_sum_h/$size_by); $srcimgfile = imagecreatefromjpeg($temp_sum); $newimgfile = imagecreatetruecolor($newsize_w,$newsize_h); imagecopyresampled($newimgfile,$srcimgfile,0,0,0,0,$newsize_w,$newsize_h,$temp_sum_w,$temp_sum_h); //指定画像サイズで保存 imagejpeg($newimgfile,"../img/item/sum/".$list_item_list_id."/i".$i.".jpg"); imagedestroy($newimgfile); imagedestroy($srcimgfile); } /* ---------------------------------------------------------------------------------------------------- */ } //テンポラリファイルの削除 if(file_exists($movefile) == true){ unlink($movefile); } } ?>