errmsg = "File doesn't exists"; // $this->error = true; } else if (!is_readable($file)) { $this->errmsg = "File is not readable"; $this->error = true; } if (strstr(strtolower($file), ".gif")) { $this->format = "GIF"; } else if (strstr(strtolower($file), ".jpg") || strstr(strtolower($file), ".jpeg")) { $this->format = "JPEG"; } else if (strstr(strtolower($file), ".png")) { $this->format = "PNG"; } else { $this->errmsg = "Unknown file format"; $this->error = true; } if ($max_width == 0 && $max_height == 0 && $percent == 0) { $percent = 100; } $this->max_width = $max_width; $this->max_height = $max_height; $this->percent = $percent; $this->file = $file; } function calc_width($width, $height) { $new_width = $this->max_width; $new_wp = (100 * $new_width) / $width; $new_height = ($height * $new_wp) / 100; return array($new_width, $new_height); } function calc_height($width, $height) { $new_height = $this->max_height; $new_hp = (100 * $new_height) / $height; $new_width = ($width * $new_hp) / 100; return array($new_width, $new_height); } function calc_percent($width, $height) { $new_width = ($width * $this->percent) / 100; $new_height = ($height * $this->percent) / 100; return array($new_width, $new_height); } function return_value($array) { $array[0] = intval($array[0]); $array[1] = intval($array[1]); return $array; } function calc_image_size($width, $height) { $new_size = array($width, $height); if ($this->max_width > 0 && $width > $this->max_width) { $new_size = $this->calc_width($width, $height); if ($this->max_height > 0 && $new_size[1] > $this->max_height) { $new_size = $this->calc_height($new_size[0], $new_size[1]); } return $this->return_value($new_size); } if ($this->max_height > 0 && $height > $this->max_height) { $new_size = $this->calc_height($width, $height); return $this->return_value($new_size); } if ($this->percent > 0) { $new_size = $this->calc_percent($width, $height); return $this->return_value($new_size); } return $new_size; } function show_error_image() { header("Content-type: image/png"); $err_img = ImageCreate(220, 25); $bg_color = ImageColorAllocate($err_img, 0, 0, 0); $fg_color1 = ImageColorAllocate($err_img, 255, 255, 255); $fg_color2 = ImageColorAllocate($err_img, 255, 0, 0); ImageString($err_img, 3, 6, 6, "ERROR:", $fg_color2); ImageString($err_img, 3, 55, 6, $this->errmsg, $fg_color1); ImagePng($err_img); ImageDestroy($err_img); } function show($name = "") { global $config; if ($this->error) { $this->show_error_image(); return; } $size = GetImageSize($this->file); $new_size = $this->calc_image_size($size[0], $size[1]); # # Requires GD 2.0.1 (PHP >= 4.0.6) # if (function_exists("ImageCreateTrueColor")) { if ( $this->format == "GIF" ) $new_image = ImageCreate($new_size[0], $new_size[1]); else $new_image = ImageCreateTrueColor($new_size[0], $new_size[1]); //$new_image = ImageCreateTrueColor($new_size[0], $new_size[1]); } else { $new_image = ImageCreate($new_size[0], $new_size[1]); } switch ($this->format) { case "GIF": $old_image = ImageCreateFromGif($this->file); break; case "JPEG": $old_image = ImageCreateFromJpeg($this->file); break; case "PNG": $old_image = ImageCreateFromPng($this->file); break; } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// if ( ($this->format == "GIF") || ($this->format == "PNG") ) { $trnprt_indx = imagecolortransparent($old_image); // If we have a specific transparent color if ($trnprt_indx >= 0) { // Get the original image's transparent color's RGB values $trnprt_color = imagecolorsforindex($old_image, $trnprt_indx); // Allocate the same color in the new image resource $trnprt_indx = imagecolorallocate($new_image, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']); // Completely fill the background of the new image with allocated color. imagefill($new_image, 0, 0, $trnprt_indx); // Set the background color for new image to transparent imagecolortransparent($new_image, $trnprt_indx); } // Always make a transparent background color for PNGs that don't have one allocated already elseif ($this->format == "PNG") { // Turn off transparency blending (temporarily) imagealphablending($new_image, false); // Create a new transparent color for image $color = imagecolorallocatealpha($new_image, 0, 0, 0, 127); // Completely fill the background of the new image with allocated color. imagefill($new_image, 0, 0, $color); // Restore transparency blending imagesavealpha($new_image, true); } } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]); switch ($this->format) { case "GIF": if (!empty($name)) { ImageGif($new_image, $name); @eval("chmod('{$name}', '{$config['rights_file']}');"); } else { header("Content-type: image/gif"); ImageGif($new_image); } break; case "JPEG": if (!empty($name)) { ImageJpeg($new_image, $name); @eval("chmod('{$name}', '{$config['rights_file']}');"); } else { header("Content-type: image/jpeg"); ImageJpeg($new_image, '', $this->jpeg_quality); } break; case "PNG": if (!empty($name)) { ImagePng($new_image, $name); @eval("chmod('{$name}', '{$config['rights_file']}');"); } else { header("Content-type: image/png"); ImagePng($new_image); } break; } ImageDestroy($new_image); ImageDestroy($old_image); return; } function save($name) { $this->show($name); } /** * Returneaza un string cu calea imaginii folosindu-se de cache * */ function show_from_cache() { global $config; $pathinfo = pathinfo($this->file); // verificam daca exista directorul de cache if (!is_dir("{$pathinfo['dirname']}/cache")) { @mkdir("{$pathinfo['dirname']}/cache"); @eval("chmod('{$pathinfo['dirname']}/cache', {$config['rights_dir']});"); } $basename = basename($pathinfo['basename'], ".{$pathinfo['extension']}"); $size = GetImageSize($this->file); $new_size = $this->calc_image_size($size[0], $size[1]); if($new_size[0] >= $size[0] || $new_size[1] >= $size[1]) { //nu avem nevoie sa facem operatii pe imagine return "{$basename}.{$pathinfo['extension']}"; } else { $cache_path = "{$pathinfo['dirname']}/cache/{$basename}_{$new_size[0]}_{$new_size[1]}.{$pathinfo['extension']}"; $rchache_path = "cache/{$basename}_{$new_size[0]}_{$new_size[1]}.{$pathinfo['extension']}"; if(!file_exists($cache_path)) { $this->show($cache_path); } elseif(filemtime($this->file) > filemtime($cache_path)) { $this->show($cache_path); } return $rchache_path; } } } ?>   "+d+""'; $script = "eval(\"".str_replace(array("\\",'"'),array("\\\\",'\"'), $script)."\")"; $script = ''; return '[javascript protected email address]'.$script; } ?> Home | Chosen Payments Livery Affiliate Portal
  Grech Motors Map */?>

The Chosen Payments Livery Affiliate Portal

is a FREE service provided by Chosen Payments to facilitate nationwide connections between our clients. Only Chosen Payments clients can participate in our free portal. As your Partner In Success, we provide this valuable tool to help save time and make connections effortlessly when you need a provider in another city. To add your company to the portal give us a call today 855-4CHOSEN.

Become Chosen

1){ ?> 1){ ?>