New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request]: Add watermark #4
Comments
what type of watermark did you want to apply, I think we can add this feature with the following options: protected static $imageFields = [
'poster' => [
'width' => 800,
'height' => 600,
'watermark' => [
'type' => 'text', // can be 'image' or 'text'
'source' => 'Copyright QCod', // 'text' or 'image path'
'position' => `bottom-right`,
'offset' => [x, y]
]
] what you think, any suggestion. |
You should always keep original before add watermark or resize or crop I think it very important We can add a command to remove all image and create another one when user change watermark source. You know what I mean? For example, we have an image with watermark is xxxxx but somehow we need to change xxxxx to ccccc |
I think you should use manual resize for this feature. // disable the auto upload
$model->setImagesField(['cover' => ['auto_upload' => false]);
// maually resize it
$originalImage = request()->file('orginalFile');
$resizedImage = $user->resizeImage($imageFile, [ 'width' => 800 ]);
// now watermark it
// check this to implement it http://image.intervention.io/api/insert I will add a generic watermark option in this package later. I am afraid your use case won't be covered completely with this, but here is what I will be adding: protected static $imageFields = [
'poster' => [
'width' => 800,
'height' => 600,
'keep_original' => true, // keep the original with `original-` prefixed filename
'watermark' => [
'type' => 'text', // can be 'image' or 'text'
'style' => 'single or repeat'
'source' => 'Copyright QCod', // 'text' or 'image path'
'position' => `bottom-right`,
'offset' => [x, y]
]
] |
How about adding a protected static $imageFields = [
'poster' => [
'width' => 800,
'height' => 600,
'keep_original' => true, // keep the original with `original-` prefixed filename
'before_save' =>function($image) {
// Do some stuff ...
},
'after_save' =>function($image) {
// Create the another image with the watermark
},
] I can make the PR for the callbacks |
@shadoWalker89 that will be great if you can pr this, give option to pass a closer or a class name with handle method on that class will get triggered |
Closing #8 feature added with hooks |
Thanks guys |
Can we backup original image then add watermark to an image?
The text was updated successfully, but these errors were encountered: