ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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_SSL_VERIFYHOST, 0);
44  $c->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
45  $c->setOpt(CURLOPT_MAXREDIRS, 3);
46  $c->setOpt(CURLOPT_HEADER, 0);
47  $c->setOpt(CURLOPT_RETURNTRANSFER, 1);
48  $c->setOpt(CURLOPT_FILE, $file);
49  try {
50  $c->exec();
51  $size = @getimagesize($filename);
52  }
53  catch (ilCurlConnectionException $e) {
54  $size = false;
55  }
56  $c->close();
57  fclose($file);
58  unlink($filename);
59  }
60  else
61  {
62  $size = @getimagesize($a_location);
63  }
64  }
65  else
66  {
67  $size = @getimagesize($a_location);
68  }
69  return $size;
70  }
71 }
72 
73 ?>
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$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.
static getDataDir()
get data directory (outside webspace)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _getInstance()
Getter for unique instance.