ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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  fclose($file);
48  $size = @getimagesize($a_location);
49  unlink($filename);
50  }
51  else
52  {
53  $size = @getimagesize($a_location);
54  }
55  }
56  else
57  {
58  $size = @getimagesize($a_location);
59  }
60  return $size;
61  }
62 }
63 
64 ?>
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.