コード例 #1
0
ファイル: actions.class.php プロジェクト: 42medien/spreadly
 public function executeGet_images(sfWebRequest $request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $this->getResponse()->setContentType('application/json');
     $lUrl = $request->getParameter("url");
     $lImages = ImageParser::fetch($lUrl);
     $lImages[] = image_path("/img/share/default.png", true);
     $lReturn['count'] = count($lImages);
     $lReturn['html'] = $this->getPartial('like/meta_images_list', array('pImages' => $lImages));
     return $this->renderText(json_encode($lReturn));
 }
コード例 #2
0
ファイル: index.php プロジェクト: shoaibi/image-parser
<?php

require 'ImageParser.php';
ImageParser::generateHtmlPage();
コード例 #3
0
$hash = $_GET['arg1'];
$width = $_GET['arg2'];
$height = $_GET['arg3'];
$image = false;
//This is a normal url
if (preg_match('@^https?://@i', $url)) {
    $turl = str_replace('https://', 'http://', $url);
    $image = imagecreatefromstring(file_get_contents($turl));
    //this was a data string...might be problems with request string being too long
} elseif (preg_match('/^data/', $url)) {
    $image = imagecreatefromstring($url);
}
//get finish
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round($finish - $start, 4);
$x = imagesx($image);
$y = imagesy($image);
//print response
$resp = new ImageLoadResponse();
$resp->hash = $hash;
$resp->url = $url;
$resp->result = ImageParser::respond($image, $width, $height, $total_time);
$resp->time = $total_time;
$resp->htmlWidth = $width;
$resp->htmlHeight = $height;
$resp->actualWidth = $x;
$resp->actualHeight = $y;
echo json_encode($resp);
コード例 #4
0
ファイル: HtmlBodyWrap.php プロジェクト: Nubtehy/openProjects
 /**
  * Check document image dimensions are set and good.  This will take
  * as long as the longest image takes to load
  * 
  * {code}
  * class ImageLoadResponse{
  * 	public $url; //url of image requested.  Should be able to use hash to find Node
  * 	public $result; //1=good, -1=failed to check, 0=sizes did not match
  * 	public $hash; //Node hash
  *  public $time; //in seconds
  * }
  * {/code}
  * 
  * @return ImageLoadResponse[] An array of ImageLoadResponse
  * 
  * @see ImageLoadResponse
  * @see Node
  */
 public function checkImages()
 {
     require_once "../class/ImageParser.php";
     $imgs = $this->parser->getTags('img');
     return ImageParser::checkActualDimsThreaded($imgs);
 }