You are here

public static function FileCommited::isTransparent in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Is file transoarent.

1 call to FileCommited::isTransparent()
FileCommited::addPaddingsToImageNative in src/Flmngr/FileUploaderServer/lib/file/FileCommited.php
Adds paddings to image.

File

src/Flmngr/FileUploaderServer/lib/file/FileCommited.php, line 372

Class

FileCommited
Commited file (data structure about the file of finished upload transaction). Has method for resizing images (applying sizes when finishing transaction).

Namespace

Drupal\n1ed\Flmngr\FileUploaderServer\lib\file

Code

public static function isTransparent($image) {
  $w = imagesx($image) - 1;
  $w2 = floor($w / 2.0);
  $h = imagesy($image) - 1;
  $h2 = floor($w / 2.0);
  if (FileCommited::isPixelTransparent($image, 0, 0)) {
    return TRUE;
  }
  if (FileCommited::isPixelTransparent($image, $w, 0)) {
    return TRUE;
  }
  if (FileCommited::isPixelTransparent($image, 0, $h)) {
    return TRUE;
  }
  if (FileCommited::isPixelTransparent($image, $w, $h)) {
    return TRUE;
  }
  if ($w2 != $w || $h2 != $h) {
    if (FileCommited::isPixelTransparent($image, $w2, 0)) {
      return TRUE;
    }
    if (FileCommited::isPixelTransparent($image, $w, $h2)) {
      return TRUE;
    }
    if (FileCommited::isPixelTransparent($image, $w2, $h)) {
      return TRUE;
    }
    if (FileCommited::isPixelTransparent($image, 0, $h2)) {
      return TRUE;
    }
  }
  return FALSE;
}