TecBrat Posted April 14, 2009 Share Posted April 14, 2009 I have written a function, is_cmyk(); that can test jpeg and psd images, but I would like to add the ability to check for images contained in a pdf document. Does anyone know how to read this data using php? I'll paste my existing code so you'll know the direction I am headed. function is_cmyk($filename) // currently ony works for jpg and psd. psd requires classPhpPsdReader.php by Tim de Koning { $matches=split('\.',$filename); foreach ($matches as $key=>$value) { $extension=$value; //if there is more than one period, this will find the actual extension. } switch ($extension) { case 'psd': include('classPhpPsdReader.php'); $psd = new PhpPsdReader($filename); if($psd->infoArray['colorMode']==4) { return TRUE; } break; case 'jpg': $size = getimagesize($filename); //echo ("get image size found $size[channels] channels"); if($size[channels]==4) { return TRUE; } default: return FALSE; break; } return FALSE; } Link to comment https://forums.phpfreaks.com/topic/154094-function-to-check-images-inside-uploaded-pdf-for-cmyk-color-mode/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.