ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMediaImageUtil.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
20 public static function getImageSize($a_location)
21 {
22 if (substr($a_location, 0, 4) == "http") {
23 include_once("./Services/WebServices/Curl/classes/class.ilCurlConnection.php");
25 $dir = ilUtil::getDataDir() . "/temp/mob/remote_img";
27 $filename = $dir . "/" . uniqid();
28 $file = fopen($filename, "w");
29 $c = new ilCurlConnection($a_location);
30 $c->init();
31 require_once './Services/Http/classes/class.ilProxySettings.php';
32 if (ilProxySettings::_getInstance()->isActive()) {
33 $proxy = ilProxySettings::_getInstance()->getHost();
34 if (($p = ilProxySettings::_getInstance()->getPort()) != "") {
35 $proxy .= ":" . $p;
36 }
37 $c->setOpt(CURLOPT_PROXY, $proxy);
38 }
39 $c->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
40 $c->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
41 $c->setOpt(CURLOPT_MAXREDIRS, 3);
42 $c->setOpt(CURLOPT_HEADER, 0);
43 $c->setOpt(CURLOPT_RETURNTRANSFER, 1);
44 $c->setOpt(CURLOPT_FILE, $file);
45 try {
46 $c->exec();
47 $size = @getimagesize($filename);
48 } catch (ilCurlConnectionException $e) {
49 $size = false;
50 }
51 $c->close();
52 fclose($file);
53 unlink($filename);
54 } else {
55 $size = @getimagesize($a_location);
56 }
57 } else {
58 $size = @getimagesize($a_location);
59 }
60 return $size;
61 }
62}
$size
Definition: RandomTest.php:84
An exception for terminatinating execution or to throw for unit testing.
static _isCurlExtensionLoaded()
Check if curl extension is loaded.
Image utility class.
static getImageSize($a_location)
Get image size from location.
static _getInstance()
Getter for unique instance.
static getDataDir()
get data directory (outside webspace)
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file