very hacky implementation of item create endpoint
This commit is contained in:
parent
edc7078c51
commit
5b8686599f
2 changed files with 26 additions and 12 deletions
|
@ -11,14 +11,19 @@ $quality = 90;
|
|||
$thumb = getcwd() . $_GET["id"];
|
||||
$img = str_replace("thumbnails", "staticimages", $thumb);
|
||||
if (is_file($img)) {
|
||||
$imagick = new Imagick($img);
|
||||
$imagick->setImageFormat('jpeg');
|
||||
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
|
||||
$imagick->setImageCompressionQuality($quality);
|
||||
$imagick->cropThumbnailImage($width, $height);
|
||||
$imagick->setImagePage(0, 0, 0, 0);
|
||||
if (file_put_contents($thumb, $imagick) === false) {
|
||||
log_error("Could not put contents.");
|
||||
try {
|
||||
$imagick = new Imagick($img);
|
||||
$imagick->setImageFormat('jpeg');
|
||||
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
|
||||
$imagick->setImageCompressionQuality($quality);
|
||||
$imagick->cropThumbnailImage($width, $height);
|
||||
$imagick->setImagePage(0, 0, 0, 0);
|
||||
if (file_put_contents($thumb, $imagick) === false) {
|
||||
log_error("Could not put contents.");
|
||||
}
|
||||
}catch(Exception $exception){
|
||||
log_error($exception);
|
||||
$imagick = file_get_contents($img);
|
||||
}
|
||||
|
||||
header("Content-type: image/jpeg");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue