LoginSignup
4
5

More than 5 years have passed since last update.

PHP imagemagickでの画像破損&CMYKチェック

Posted at

PHP imagemagickで

// CMYKチェック
// $filename = 画像ファイルパス
//
function f_check_CMYK($filename)
{
  $rtn_st = "OK";
  $im = new Imagick($filename);
  $colorspace = $im->getImageColorspace();
  if($colorspace==12) //12ならCMYK
  {
    $rtn_st = "CMYK";
  }
  return $rtn_st;
}
//画像破損チェック
// $filename = 画像ファイルパス
//
function f_djpeg_check($filename)
{
  if(imagecreatefromjpeg($filename)==false)
  {
    $rtn_st = "NG";
  }else{
    $rtn_st = "OK";
  }
  return $rtn_st;
}
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5