You are here

public static function Watermark::getFuncName in Media watermark 8

Helper to get function name suffix.

Parameters

string $ext: File extension.

Return value

string Function name suffix.

1 call to Watermark::getFuncName()
Watermark::createImage in src/Watermark/Watermark.php
Function to create image (.jpg, .jpeg, .png, .gif) file.

File

src/Watermark/Watermark.php, line 150

Class

Watermark
Custom watermark class.

Namespace

Drupal\media_watermark\Watermark

Code

public static function getFuncName($ext) {
  $func_name = '';
  if (!empty($ext) && is_string($ext)) {
    $ext = strtolower($ext);
    if ($ext == 'jpg' || $ext == 'jpeg') {
      $func_name = 'jpeg';
    }
    elseif ($ext == 'png') {
      $func_name = 'png';
    }
    elseif ($ext == 'gif') {
      $func_name = 'gif';
    }
  }
  return $func_name;
}