ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Worksheet\Drawing Class Reference
+ Inheritance diagram for PhpOffice\PhpSpreadsheet\Worksheet\Drawing:
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Worksheet\Drawing:

Public Member Functions

 __construct ()
 Create a new Drawing. More...
 
 getFilename ()
 Get Filename. More...
 
 getIndexedFilename ()
 Get indexed filename (using image index). More...
 
 getExtension ()
 Get Extension. More...
 
 getPath ()
 Get Path. More...
 
 setPath ($pValue, $pVerifyFile=true)
 Set Path. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing
 __construct ()
 Create a new BaseDrawing. More...
 
 getImageIndex ()
 Get image index. More...
 
 getName ()
 Get Name. More...
 
 setName ($pValue)
 Set Name. More...
 
 getDescription ()
 Get Description. More...
 
 setDescription ($description)
 Set Description. More...
 
 getWorksheet ()
 Get Worksheet. More...
 
 setWorksheet (?Worksheet $pValue=null, $pOverrideOld=false)
 Set Worksheet. More...
 
 getCoordinates ()
 Get Coordinates. More...
 
 setCoordinates ($pValue)
 Set Coordinates. More...
 
 getOffsetX ()
 Get OffsetX. More...
 
 setOffsetX ($pValue)
 Set OffsetX. More...
 
 getOffsetY ()
 Get OffsetY. More...
 
 setOffsetY ($pValue)
 Set OffsetY. More...
 
 getWidth ()
 Get Width. More...
 
 setWidth ($pValue)
 Set Width. More...
 
 getHeight ()
 Get Height. More...
 
 setHeight ($pValue)
 Set Height. More...
 
 setWidthAndHeight ($width, $height)
 Set width and height with proportional resize. More...
 
 getResizeProportional ()
 Get ResizeProportional. More...
 
 setResizeProportional ($pValue)
 Set ResizeProportional. More...
 
 getRotation ()
 Get Rotation. More...
 
 setRotation ($pValue)
 Set Rotation. More...
 
 getShadow ()
 Get Shadow. More...
 
 setShadow (?Drawing\Shadow $pValue=null)
 Set Shadow. More...
 
 getHashCode ()
 Get hash code. More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 
 setHyperlink (?Hyperlink $pHyperlink=null)
 
 getHyperlink ()
 

Private Attributes

 $path
 

Additional Inherited Members

- Protected Attributes inherited from PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing
 $name
 
 $description
 
 $worksheet
 
 $coordinates
 
 $offsetX
 
 $offsetY
 
 $width
 
 $height
 
 $resizeProportional
 
 $rotation
 
 $shadow
 

Detailed Description

Definition at line 7 of file Drawing.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::__construct ( )

Create a new Drawing.

Definition at line 19 of file Drawing.php.

20  {
21  // Initialise values
22  $this->path = '';
23 
24  // Initialize parent
25  parent::__construct();
26  }

Member Function Documentation

◆ getExtension()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::getExtension ( )

Get Extension.

Returns
string

Definition at line 56 of file Drawing.php.

Referenced by PhpOffice\PhpSpreadsheet\Worksheet\Drawing\getIndexedFilename().

57  {
58  $exploded = explode('.', basename($this->path));
59 
60  return $exploded[count($exploded) - 1];
61  }
+ Here is the caller graph for this function:

◆ getFilename()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::getFilename ( )

Get Filename.

Returns
string

Definition at line 33 of file Drawing.php.

Referenced by PhpOffice\PhpSpreadsheet\Worksheet\Drawing\getIndexedFilename().

34  {
35  return basename($this->path);
36  }
+ Here is the caller graph for this function:

◆ getHashCode()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

Definition at line 106 of file Drawing.php.

107  {
108  return md5(
109  $this->path .
110  parent::getHashCode() .
111  __CLASS__
112  );
113  }

◆ getIndexedFilename()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::getIndexedFilename ( )

Get indexed filename (using image index).

Returns
string

Definition at line 43 of file Drawing.php.

References PhpOffice\PhpSpreadsheet\Worksheet\Drawing\getExtension(), PhpOffice\PhpSpreadsheet\Worksheet\Drawing\getFilename(), and PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing\getImageIndex().

44  {
45  $fileName = $this->getFilename();
46  $fileName = str_replace(' ', '_', $fileName);
47 
48  return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
49  }
+ Here is the call graph for this function:

◆ getPath()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::getPath ( )

Get Path.

Returns
string

Definition at line 68 of file Drawing.php.

References $path.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Xls\processDrawing().

69  {
70  return $this->path;
71  }
$path
Definition: aliased.php:25
+ Here is the caller graph for this function:

◆ setPath()

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::setPath (   $pValue,
  $pVerifyFile = true 
)

Set Path.

Parameters
string$pValueFile path
bool$pVerifyFileVerify file
Returns
$this

Definition at line 81 of file Drawing.php.

82  {
83  if ($pVerifyFile) {
84  if (file_exists($pValue)) {
85  $this->path = $pValue;
86 
87  if ($this->width == 0 && $this->height == 0) {
88  // Get width/height
89  [$this->width, $this->height] = getimagesize($pValue);
90  }
91  } else {
92  throw new PhpSpreadsheetException("File $pValue not found!");
93  }
94  } else {
95  $this->path = $pValue;
96  }
97 
98  return $this;
99  }

Field Documentation

◆ $path

PhpOffice\PhpSpreadsheet\Worksheet\Drawing::$path
private

Definition at line 14 of file Drawing.php.


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