Apache2-ApacheMobileFilter

 view release on metacpan or  search on metacpan

lib/Apache2/AMFImageRendering.pm  view on Meta::CPAN

			    ModPerl::Util::exit();
		}
		if ($ENV{ResizeSmallImage}) {
			$resizeimagesmall=$ENV{ResizeSmallImage};
			$CommonLib->printLog("ResizeSmallImage is: $resizeimagesmall. The image smallest of device screensize is also resized (low quality)");
		}
		if ($ENV{TypeGraphicLibrary}) {
      if ($ENV{TypeGraphicLibrary} eq 'gd' || $ENV{TypeGraphicLibrary} eq 'magick') {
        $typeGraphicLibrary=$ENV{TypeGraphicLibrary};
        $CommonLib->printLog("TypeGraphicLibrary is: $typeGraphicLibrary");
      } else {
			    $CommonLib->printLog("ERROR: TypeGraphicLibrary parameter must be 'gd' or 'magick'");
			    ModPerl::Util::exit();        
      }
		}
		if ($ENV{QualityImage}) {
      if (($ENV{QualityImage} =~ /^\d+?$/) && $ENV{QualityImage} > -1 && $ENV{QualityImage} < 101) {
        $qualityImage=$ENV{QualityImage};
      } else {
			    $CommonLib->printLog("ERROR: QualityImage must be a number from 0 (lower) to 100 (higher), default is: ".$qualityImage);
      }
		}
		if ($ENV{MaxAgeImage}) {
      if (($ENV{MaxAgeImage} =~ /^\d+?$/) && $ENV{MaxAgeImage} > 0 ) {
        $maxAgeImage=$ENV{MaxAgeImage};
        $CommonLib->printLog("MaxAgeImage is: ".$maxAgeImage." (seconds)");
      } else {
			    $CommonLib->printLog("ERROR: MaxAgeImage must be a number > 0");
      }
		}
    $CommonLib->printLog("QualityImage is: ".$qualityImage);
		if ($ENV{TypeMagickFilter}) {
      my %params = map { $_ => 1 } @arrayFilterMagick;
      if(exists($params{$ENV{TypeMagickFilter}})) {
        $filterMagick=$ENV{TypeMagickFilter};
        $CommonLib->printLog("TypeMagickFilter is: $filterMagick");
      } else {
			    $CommonLib->printLog("ERROR: TypeMagickFilter filter ".$ENV{TypeMagickFilter}." not available, the default is ".$filterMagick);
          my $stringFilters='';
          foreach my $filter (@arrayFilterMagick){
            $stringFilters=$stringFilters."'".$filter."' ";
          }
			    $CommonLib->printLog("The available filters are: ".$stringFilters."for more info http://www.imagemagick.org/Usage/filter/");          
      }
		} else {
      if ($ENV{TypeGraphicLibrary} eq 'magick') {
			    $CommonLib->printLog("TypeMagickFilter is not set, the default is ".$filterMagick);        
      }
      
    }
	      	if ($ENV{ImageParamWidth}) {
				$par_width=$ENV{ImageParamWidth};
				$CommonLib->printLog("ImageParamWidth is: $par_width. To force the width of image the url must be <url image>?$par_width=<width>");
		} 
	      	if ($ENV{ImageParamHeight}) {
				$par_height=$ENV{ImageParamHeight};
				$CommonLib->printLog("ImageParamHeight is: $par_height. To force the height of image the url must be <url image>?$par_width=<height>");
		} 
	      	if ($ENV{ImageParamPerc}) {
				$par_perc=$ENV{ImageParamPerc};
				$CommonLib->printLog("ImageParamPerc is: $par_perc. To force the percentage of image the url must be <url image>?$par_perc=<percentage>");
		} 

	    $CommonLib->printLog("Finish loading  parameter");
}
sub handler    {
      my $f = shift;
      my $capability2;
      my $s = $f->r->server;
      my $query_string=$f->r->args;
      my $uri = $f->r->uri();
      #$uri =~ s/\//_/g;
      my $content_type=$f->r->content_type();
      my @fileArray = split(/\//, $uri);
      my $file=$fileArray[-1];
      my $docroot = $f->r->document_root();
      #$docroot =~ s/\//_/g;
      my $servername=$f->r->get_server_name();
      my $id="";
      my $method="";     
      my $location;
      my $width_toSearch;
      my $type_redirect="internal";
      my $return_value=Apache2::Const::DECLINED;
	  my $dummy="";
	  my $variabile2="";
	  my %ArrayCapFound;
	  my $controlCookie;
	  my $query_img="";
      my %ArrayQuery;
      my $var;
      my $cookie = $f->r->headers_in->{Cookie} || '';
      my $width=1000;
      my $height=1000;
      my $image2="";
      my $device_claims_web_support='null';
      my $is_wireless_device='null';
      my $isMobile='true';

      $content_type=lc($content_type);
      if ($f->r->pnotes('max_image_width')) {      
      	$width=$f->r->pnotes('max_image_width')
      }
      if ($f->r->pnotes('max_image_height')) {
         $height=$f->r->pnotes('max_image_height');
      }
      if ($f->r->pnotes('amf_device_ismobile')) {
        $isMobile=$f->r->pnotes('amf_device_ismobile');
      }
      
      $repasshanlder=$repasshanlder + 1;
	  $return_value=Apache2::Const::DECLINED;
 	  #
 	  # Reading value of query string 
 	  #
      if ($query_string) {
			my @vars = split(/&/, $query_string); 	  
			foreach $var (sort @vars){
					 if ($var) {
						  my ($v,$i) = split(/=/, $var);
						  $v =~ tr/+/ /;



( run in 2.391 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )