ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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  static function getImageSize($a_location)
21  {
22  if (substr($a_location, 0, 4) == "http")
23  {
24  include_once("./Services/WebServices/Curl/classes/class.ilCurlConnection.php");
26  {
27  $dir = ilUtil::getDataDir() . "/temp/mob/remote_img";
29  $filename = $dir."/".uniqid();
30  $file = fopen($filename, "w");
31  $c = new ilCurlConnection($a_location);
32  $c->init();
33  require_once './Services/Http/classes/class.ilProxySettings.php';
34  if (ilProxySettings::_getInstance()->isActive())
35  {
36  $proxy = ilProxySettings::_getInstance()->getHost();
37  if (($p = ilProxySettings::_getInstance()->getPort()) != "")
38  {
39  $proxy .= ":" . $p;
40  }
41  $c->setOpt(CURLOPT_PROXY, $proxy);
42  }
43  $c->setOpt(CURLOPT_MAXREDIRS, 3);
44  $c->setOpt(CURLOPT_HEADER, 0);
45  $c->setOpt(CURLOPT_RETURNTRANSFER, 1);
46  $c->setOpt(CURLOPT_FILE, $file);
47  $c->exec();
48  $c->close();
49  fclose($file);
50  $size = @getimagesize($filename);
51  unlink($filename);
52  }
53  else
54  {
55  $size = @getimagesize($a_location);
56  }
57  }
58  else
59  {
60  $size = @getimagesize($a_location);
61  }
62  return $size;
63  }
64 }
65 
66 ?>
static makeDirParents($a_dir)
Create a new directory and all parent directories.
print $file
$size
Definition: RandomTest.php:79
static getImageSize($a_location)
Get image size from location.
Image utility class.
static _isCurlExtensionLoaded()
Check if curl extension is loaded.
$filename
Definition: buildRTE.php:89
static getDataDir()
get data directory (outside webspace)
static _getInstance()
Getter for unique instance.