"\xc4\x85", "\xa5" => "\xc4\x84", "\xe6" => "\xc4\x87", "\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" => "\xc4\x98", "\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" => "\xc3\xb3", "\xd3" => "\xc3\x93", "\x9c" => "\xc5\x9b", "\x8c" => "\xc5\x9a", "\xbf" => "\xc5\xbc", "\x8f" => "\xc5\xbb", "\x9f" => "\xc5\xba", "\xaf" => "\xc5\xb9", "\xf1" => "\xc5\x84", "\xd1" => "\xc5\x83" ); $iso2utf = array( "\xb1" => "\xc4\x85", "\xa1" => "\xc4\x84", "\xe6" => "\xc4\x87", "\xc6" => "\xc4\x86", "\xea" => "\xc4\x99", "\xca" => "\xc4\x98", "\xb3" => "\xc5\x82", "\xa3" => "\xc5\x81", "\xf3" => "\xc3\xb3", "\xd3" => "\xc3\x93", "\xb6" => "\xc5\x9b", "\xa6" => "\xc5\x9a", "\xbc" => "\xc5\xba", "\xac" => "\xc5\xb9", "\xbf" => "\xc5\xbc", "\xaf" => "\xc5\xbb", "\xf1" => "\xc5\x84", "\xd1" => "\xc5\x83" ); if ($type == ISO88592_TO_UTF8) return strtr($string, $iso2utf); if ($type == UTF8_TO_ISO88592) return strtr($string, array_flip($iso2utf)); if ($type == WIN1250_TO_UTF8) return strtr($string, $win2utf); if ($type == UTF8_TO_WIN1250) return strtr($string, array_flip($win2utf)); if ($type == ISO88592_TO_WIN1250) return strtr($string, "\xa1\xa6\xac\xb1\xb6\xbc", "\xa5\x8c\x8f\xb9\x9c\x9f"); if ($type == WIN1250_TO_ISO88592) return strtr($string, "\xa5\x8c\x8f\xb9\x9c\x9f", "\xa1\xa6\xac\xb1\xb6\xbc"); } function imgType($name){ if(substr($name, -4, 4) == '.jpg' || substr($name, -4, 4) == 'jpeg')return "IMAGETYPE_JPEG"; elseif(substr($name, -4, 4) == '.gif')return "IMAGETYPE_GIF"; elseif(substr($name, -4, 4) == '.png') return "IMAGETYPE_PNG"; } function resizeImage($source, $max_x, $max_y, $save_image, $jpeg_quality = 100){ if(imgType($source) == "IMAGETYPE_JPEG")$img_src = imagecreatefromjpeg($source); elseif(imgType($source) == "IMAGETYPE_GIF")$img_src = imagecreatefromgif($source); elseif(imgType($source) == "IMAGETYPE_PNG")$img_src = imagecreatefrompng($source); else die('Wrong filetype! Accepted images: JPG/JPEG, GIF, PNG'); $image_x = imagesx($img_src); $image_y = imagesy($img_src); if($image_x > $image_y){ $ratio_x = ($image_x > $max_x) ? $max_x/$image_x : 1; $ratio_y = $ratio_x; $move = 'y'; } else{ $ratio_y = ($image_y > $max_y) ? $max_y/$image_y : 1; $ratio_x = $ratio_y; $move = 'x'; } $new_x = $image_x*$ratio_x; $new_y = $image_y*$ratio_y; $move_x = ($move == "x") ? ($max_x-$new_x)/2 : 0; $move_y = ($move == "y") ? ($max_y-$new_y)/2 : 0; $new_img = imagecreatetruecolor($max_x, $max_y); $background = imagecolorallocate($new_img, 255, 255, 255); $black = imagecolorallocate($new_img,0,0,0); imagefill($new_img, 0, 0, $background); imagecopyresampled($new_img, $img_src, $move_x, $move_y, 0, 0, $new_x, $new_y, $image_x, $image_y); $ix=ceil($max_x/90); $iy=ceil($max_y/90); for($i=0;$i<$ix;$i++)imageline($new_img,$i,0,$i,$max_y,$background); for($i=0;$i<$iy;$i++)imageline($new_img,0,$i,$max_x,$i,$background); for($i=0;$i<$ix;$i++)imageline($new_img,$max_x-$i,0,$max_x-$i,$max_y,$background); for($i=0;$i<$iy;$i++)imageline($new_img,0,$max_y-$i,$max_x,$max_y-$i,$background); if(imgType($save_image) == "IMAGETYPE_JPEG")imagejpeg($new_img, $save_image,100); elseif(imgType($save_image) == "IMAGETYPE_GIF")imagegif($new_img, $save_image,100); elseif(imgType($save_image) == "IMAGETYPE_PNG") imagepng($new_img, $save_image,100); } function addExchangeRateValue($value,$field,$er,$n=false) { $tabs=array("fob_price","purchase_price","ems_price","srp_price","srp_promo_price","price","list_price"); foreach($tabs as $tab) { if($tab==$field) { if(!$n)$value=number_format($value/$er,2,",","."); else $value=$value/$er; break; } } return $value; } function sortLink($order_by,$sorder,$title) { if($order_by==$_REQUEST['order_by']) { if($sorder=="desc") { $img=''; $s="asc"; } else { $img=''; $s="desc"; } } else { $img=''; $s=$sorder; } return ''.$title.' '.$img.''; } ?>