The GD library does not support CMYK conversion, if I'm not mistaken. You would need to use ImageMagick/Imagick or GraphicsMagick/Gmagick, and to that end you could create a small script using one of these to accomplish what you want.
With ImageMagick or GraphicsMagick, you would need to have PHP make a command line call to the appropriate program using `exec()` with `convert -colorspace CMYK` to convert.
With Imagick, you could use something like this:
`
function convertCMYK($filename) {
$image = new Imagick($filename);
$image->setImageColorspace(Imagick::COLORSPACE_CMYK);
$image->writeImage($filename); // this will replace the old file!
}
`
This function will take a filename and convert that file into CMYK, replacing the old one.
The Imagick function can be directly converted to Gmagick by simply replacing Imagick with Gmagick (in the two cases).
After that, it's just a matter of printing out a link to the image, which would be simple to code in PHP or add to the function above. This is all provided that your server supports one of the above.