Skip to content

Commit

Permalink
we need more destroys
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzotikov committed Jan 13, 2025
1 parent bd2431e commit 14ca1fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/SocialMediaImageGenerator/Types/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function getImage(bool $no_resize = false): \Imagick

$mask->clear();
$mask->destroy();

$shape->clear();
$shape->destroy();
}

if ($this->getFill()) {
Expand All @@ -65,6 +68,9 @@ public function getImage(bool $no_resize = false): \Imagick
$layer->destroy();

$layer = $layer_colorize;

$layer_colorize->clear();
$layer_colorize->destroy();
}

$this->layer = $layer;
Expand Down
4 changes: 4 additions & 0 deletions src/SocialMediaImageGenerator/Types/ImageGravityCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public function getImage(bool $no_resize = true): \Imagick
$layer_colorize->compositeImage($layer, \Imagick::COMPOSITE_COPYOPACITY, 0, 0);
$layer = $layer_colorize;

$layer_colorize->clear();
$layer_colorize->destroy();
unset($im);

unset($layer_colorize);
}

Expand Down
3 changes: 3 additions & 0 deletions src/SocialMediaImageGenerator/Types/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ private function wordwrap(string $text, int $width, \ImagickDraw $draw, int &$nu
}
}

$im->clear();
$im->destroy();
unset($im);

return $final_text;
}

Expand Down

0 comments on commit 14ca1fe

Please sign in to comment.