ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMediaImageUtil Class Reference

Image utility class. More...

+ Collaboration diagram for ilMediaImageUtil:

Static Public Member Functions

static getImageSize ($a_location)
 Get image size from location. More...
 

Detailed Description

Image utility class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilMediaImageUtil.php.

Member Function Documentation

◆ getImageSize()

static ilMediaImageUtil::getImageSize (   $a_location)
static

Get image size from location.

Parameters
string$a_location
Returns
array

Definition at line 20 of file class.ilMediaImageUtil.php.

References Vendor\Package\$c, Vendor\Package\$e, $filename, $size, ilCurlConnection\_isCurlExtensionLoaded(), ilUtil\getDataDir(), and ilUtil\makeDirParents().

Referenced by ilObjMediaObject\_determineWidthHeight(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilObjMediaObjectGUI\getFullscreenSizeObject(), ilMediaItem\getOriginalSize(), and ilObjMediaObjectGUI\getStandardSizeObject().

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  $c->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
32  $c->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
33  $c->setOpt(CURLOPT_MAXREDIRS, 3);
34  $c->setOpt(CURLOPT_HEADER, 0);
35  $c->setOpt(CURLOPT_RETURNTRANSFER, 1);
36  $c->setOpt(CURLOPT_FILE, $file);
37  try {
38  $c->exec();
39  $size = @getimagesize($filename);
40  } catch (ilCurlConnectionException $e) {
41  $size = false;
42  }
43  $c->close();
44  fclose($file);
45  unlink($filename);
46  } else {
47  $size = @getimagesize($a_location);
48  }
49  } else {
50  $size = @getimagesize($a_location);
51  }
52  return $size;
53  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$size
Definition: RandomTest.php:84
static _isCurlExtensionLoaded()
Check if curl extension is loaded.
$filename
Definition: buildRTE.php:89
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: