mime_type, self::TYPES, true) || ($media->getCustomProperty('metadata_stripped') && ! $force)) { return false; } $path = $media->getPath(); if (! is_file($path)) { return false; } try { // GD on purpose: Imagick (default when installed, e.g. on Strato) keeps the EXIF data when saving. Image::useImageDriver(ImageDriver::Gd)->loadFile($path)->quality(90)->save($path); } catch (Throwable $exception) { report($exception); return false; } clearstatcache(true, $path); $media->size = (int) filesize($path); $media->setCustomProperty('metadata_stripped', true); $media->saveQuietly(); return true; } }