Skip to content
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

without mask method, how to create circle/round image with V3 version? #1338

Closed
hetao29 opened this issue Apr 29, 2024 · 2 comments
Closed

Comments

@hetao29
Copy link

hetao29 commented Apr 29, 2024

Describe the feature you'd like
Create circle/round image with V3 version

Create Image in V2

$width=$height=100;
$mask = $img_manger->canvas($width, $height);
$mask->circle($width, $width / 2, $height / 2, function ($draw){
    $draw->background('#fff');
});
$img_thumb = $img_manger->make("https://...")->fit($width,$height);
$img_thumb->mask($mask, false);
$img->insert($img_thumb,"center",32,10);

How in V3

?
@olivervogel
Copy link
Member

Unfortunately, this is currently not possible in version 3, as the mask function is no longer part of the library. My impression was that the method was rarely used and was implemented very resource-intensively with GD. For this reason, I have decided not to include this feature in the new version. I don't want to rule out the mask method becoming part of Intervention Image again at some point, but this is not a priority for me at the moment.

@hetao29
Copy link
Author

hetao29 commented Apr 30, 2024

Thanks, I use the place methd to fixed it like below:

$width_logo=120;
$handle=fopen("https://...","rb");
$img = ....


$img_thumb = new Imagick();
$img_thumb->readImageFile($handle);
$img_thumb->scaleImage($width_logo, $height_logo);
$img_thumb->roundCorners($width_logo/2,$height_logo/2);
$img_thumb->setImageFormat("png");

$img->place($img_thumb,"bottom-left",32,10);
fclose($handle);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants