Пример #1
0
 function handler_gc($page)
 {
     $if = new ImageFilter(new PFC_And(new IFC_NoSize(), new IFC_Temp()));
     $images = $if->get()->select(FrankizImageSelect::gc());
     $page->assign('images', $images);
     $page->addCssLink('images.css');
     $page->assign('title', 'Images GC');
     $page->changeTpl('images/gc.tpl');
 }
Пример #2
0
	public static function traitVign($image)
	{
		//$vign = SS_ADMIN_TO_USERFILE."/userfiles/photo/vignettes/";
		
		$vign = SS_ADMIN_TO_USERFILE."/image/entreprise/detail/";
		$tzNomV = explode("/",$image);
		$in = count($tzNomV);
		$vign .= $tzNomV[$in-1];
		$debutext = strtoupper(substr($image,strlen($image)-3,3));
		$typeExt  = $debutext = 'JPG' ? 'JPEG' : $typeExt ;
		if(substr($image,strlen($image)-4,1) != ".")
		{
			$typeExt = "JPEG" ;
		}
		$resizeimg = new ImageFilter() ;
		$resizeimg->loadImage($image) ;	
		$tiDim  = $resizeimg->getImageSize();
		if($tiDim['w']>=$tiDim['h']) {
			$resizeimg->resize (415, 275,'ratio',true) ;
		}
		else {
			$resizeimg->resize (177, 275,'ratio',true) ;
		}
		$resizeimg->output ($typeExt, $vign) ;
		return $vign;
	} 
Пример #3
0
 public function run()
 {
     // Total Users
     $f = new UserFilter(null);
     $users = $f->getTotalCount();
     $this->assign('users', $users);
     // Total Groups
     $f = new GroupFilter(null);
     $groups = $f->getTotalCount();
     $this->assign('groups', $groups);
     // Total Castes
     $f = new CasteFilter(null);
     $castes = $f->getTotalCount();
     $this->assign('castes', $castes);
     // Total News
     $f = new NewsFilter(null);
     $news = $f->getTotalCount();
     $this->assign('news', $news);
     // Total Images
     $f = new ImageFilter(null);
     $images = $f->getTotalCount();
     $this->assign('images', $images);
     $this->assign('user', S::user());
 }
Пример #4
0
 public static function is_allowed($image_file_location, $is_remoted = False)
 {
     $is_allowed = False;
     try {
         $file_size = 0;
         if ($is_remoted) {
             $file_size = ImageFilter::retrieve_remote_file_size($image_file_location);
         } else {
             $file_size = filesize($image_file_location);
         }
         if ($file_size > 0 && $file_size <= ImageFilter::$max_file_size && getimagesize($image_file_location)) {
             $is_allowed = True;
         }
     } catch (Exception $e) {
         $is_allowed = False;
     }
     return $is_allowed;
 }
Пример #5
0
 function TransformImage(&$imageString)
 {
     echo $this->imageFilter->ApplyFilter($imageString);
 }
Пример #6
0
 function handler_images($page)
 {
     $temp = Group::from('temp');
     $temp->select(GroupSelect::castes());
     $everybody_temp = $temp->caste(Rights::everybody());
     $if = new ImageFilter(new IFC_Caste($everybody_temp), new IFO_Created());
     $images = $if->get(new PlLimit(50))->select(FrankizImageSelect::base());
     $page->assign('title', 'Images du groupe temporaire');
     $page->assign('images', $images);
     $page->addCssLink('admin.css');
     $page->changeTpl('admin/images.tpl');
 }
Пример #7
0
 /**
  * Apply a given filter to this image
  *
  * @param   img.filter.ImageFilter filter
  * @return  bool
  * @throws  lang.IllegalArgumentException if filter is not a img.filter.ImageFilter
  */
 public function apply(ImageFilter $filter)
 {
     return $filter->applyOn($this);
 }
Пример #8
0
                    $r = 255;
                }
                if ($g > 255) {
                    $g = 255;
                }
                if ($b > 255) {
                    $b = 255;
                }
                if ($r < 0) {
                    $r = 0;
                }
                if ($g < 0) {
                    $g = 0;
                }
                if ($b < 0) {
                    $b = 0;
                }
                imagesetpixel($this->imgout, $x, $y, ImageColorAllocate($this->imgout, $r, $g, $b));
            }
        }
    }
}
// end class
//====================================================================================
$filter = new ImageFilter("../portfolio/photo/cjs_09.jpg");
// 이런저런 필터를준다.
$filter->brightness($key);
$filter->blur(3);
//============================ 출력
header("Content-type: image/jpeg");
ImageJpeg($filter->imgout);
Пример #9
0
    $curlTimeOut = 10;
}
if (!is_numeric($MemoryDir)) {
    $MemoryDir = 0;
}
if (!is_numeric($GLOBALS["CacheSizeItems"])) {
    $GLOBALS["CacheSizeItems"] = 50000;
}
$GLOBALS["CURL_TIMEOUT"] = $curlTimeOut;
$GLOBALS["MEM_DIR"] = $MemoryDir;
$iPicScanVal = intval($iPicScanVal);
if ($iPicScanVal > 99) {
    $iPicScanVal = 99;
}
unset($SquidNuditScanParams);
$filter = new ImageFilter();
$GLOBALS["HELPER"] = new externhelper();
while (!feof(STDIN)) {
    $url = trim(fgets(STDIN));
    if ($url == null) {
        continue;
    }
    $array = $GLOBALS["HELPER"]->parseURL($url);
    if ($GLOBALS["DEBUG_LEVEL"] > 1) {
        $GLOBALS["HELPER"]->WLOG($url . " str:" . strlen($url) . " LOGIN:{$array["LOGIN"]},IPADDR:{$array["IPADDR"]} MAC:{$array["MAC"]} HOST:{$array["HOST"]} URI:{$array["URI"]}");
    }
    $szMac = $array["MAC"];
    $szUrl = $array["URI"];
    $iScore = GetCache($szUrl);
    if ($iScore > 0) {
        if ($GLOBALS["DEBUG_LEVEL"] > 0) {
Пример #10
0
 public function AfterSetAllDatasetValues()
 {
     $valueChanged = true;
     $postWrapper = ArrayWrapper::createPostWrapper();
     $filesWrapper = ArrayWrapper::createFilesWrapper();
     $value = $this->GetEditControl()->extractFilePathFromArray($postWrapper, $filesWrapper, $valueChanged);
     if ($valueChanged && $value === null) {
         $this->clearImageAndThumbnail();
         return;
     }
     $original_file_extension = $this->GetEditControl()->extractFileTypeFromArray($postWrapper, $filesWrapper);
     $original_file_name = $this->GetEditControl()->extractFileNameFromArray($postWrapper, $filesWrapper);
     $file_size = $this->GetEditControl()->extractFileSizeFromArray($postWrapper, $filesWrapper);
     $target = $this->GetNewFileName($original_file_name, $original_file_extension, $file_size);
     if ($valueChanged && isset($target) && !empty($target)) {
         FileUtils::MoveUploadedFile($value, $target, $this->replaceUploadedFileIfExist);
         if ($this->GetSetToNullFromPost()) {
             $this->clearImageAndThumbnail();
         } elseif ($this->GetSetToDefaultFromPost()) {
             $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), null, true);
             if ($this->useThumbnailGeneration) {
                 $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, null);
             }
         } else {
             $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), $target);
             if ($this->useThumbnailGeneration) {
                 $image = file_get_contents($target);
                 $thumbnailFileName = $this->GetThumbnailFileName($original_file_name, $original_file_extension, $file_size);
                 $this->thumbnailImageFilter->ApplyFilter($image, $thumbnailFileName);
                 $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, $thumbnailFileName);
             }
         }
     }
 }
Пример #11
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/classes/ImageCoder.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/classes/ImageFilter.php';
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    $outputJson = json_encode(array());
    try {
        if (isset($_FILES['imageFile']) && $_FILES['imageFile'] && ImageFilter::is_allowed($_FILES['imageFile']['tmp_name'])) {
            $encodedImage = ImageCoder::encode($_FILES['imageFile']['tmp_name']);
            $encodedImageToDataURL = ImageCoder::encode_to_dataURL($_FILES['imageFile']['tmp_name']);
            $outputJson = json_encode(array('encodedImage' => $encodedImage, 'encodedImageToDataURL' => $encodedImageToDataURL));
        } elseif (isset($_POST['imageUrl']) && $_POST['imageUrl'] && ImageFilter::is_allowed($_POST['imageUrl'], True)) {
            // Create empty file with unique name in temporary dir
            $imgFileName = tempnam($_SERVER['DOCUMENT_ROOT'] . '/temp', 'img_to_encode_');
            // Load image data to created file
            file_put_contents($imgFileName, file_get_contents($_POST['imageUrl']));
            $encodedImage = ImageCoder::encode($imgFileName);
            $encodedImageToDataURL = ImageCoder::encode_to_dataURL($imgFileName);
            $outputJson = json_encode(array('encodedImage' => $encodedImage, 'encodedImageToDataURL' => $encodedImageToDataURL));
            unlink($imgFileName);
        }
    } catch (Exception $e) {
        $outputJson = json_encode(array());
    }
    echo $outputJson;
}
Пример #12
0
<?php

include "config.php";
include "pdo.class.php";
include "ImageFilter.class.php";
include "functions.php";
$pdo = Db::singleton();
$body = censorString(cleanVar($_POST['Body'], 'text'));
$from = cleanVar($_POST['From'], 'phone');
$media = '';
$numMedia = $_POST['NumMedia'];
if ($numMedia > 0) {
    for ($i = 0; $i <= $numMedia; $i++) {
        $key = 'MediaUrl' . $i;
        $media = $_POST[$key];
        if (isset($media) && !empty($media)) {
            $media = cache_image($media, $id);
            $filter = new ImageFilter();
            $score = $filter->GetScore($media);
            if (isset($score)) {
                if ($score >= 30) {
                    unlink($media);
                } else {
                    $res = $pdo->query("INSERT INTO call_log SET msg='{$body}',phonenumber='{$from}',photo='{$media}',type='s'");
                }
            }
        }
    }
}
Пример #13
0
//   License either version 2, or (at your option) any later version.
//
//   ISLAMIC RULES should be followed and respected if they differ
//   than terms of the GNU LESSER GENERAL PUBLIC LICENSE
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the license with this software;
//   If not, please contact support @ S y s T u r n .com to receive a copy.
//
if (isset($_FILES['userimage'])) {
    require_once 'filter.class.php';
    $filter = new ImageFilter();
    $score = $filter->GetScore($_FILES['userimage']['tmp_name']);
}
?>
 
<html> 
<head> 
    <title>Image Filter Example</title> 
</head> 
<body> 
<?php 
if (isset($score)) {
    ?>
 
    <?php 
    if ($score >= 30) {
Пример #14
0
 public static function apply(Canvas $canvas, ImageFilter $filter)
 {
     $filter->applyFilter($canvas);
 }