Skip to content

Commit

Permalink
dont copy to memory if non animated
Browse files Browse the repository at this point in the history
  • Loading branch information
deluxetom committed Jan 20, 2025
1 parent 7c1bd64 commit 34107aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ public function frame(int $position): FrameInterface
throw new AnimationException('Frame #' . $position . ' could not be found in the image.');
}

if ($count === 1) {
return new Frame($this->vipsImage);
}

$sequential = in_array('vips-sequential', $this->vipsImage->getFields()) ?
$this->vipsImage->get('vips-sequential') : null;

if ($sequential) {
$this->vipsImage = $this->vipsImage->copyMemory();
}

if ($count === 1) {
return new Frame($this->vipsImage);
}

$delay = in_array('delay', $this->vipsImage->getFields()) ?
($this->vipsImage->get('delay')[$position] ?? 0) : null;

Expand Down

3 comments on commit 34107aa

@deluxetom
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olivervogel I was having issues on my production server with the updated cover modifier and it seems it was because of copyMemory when there was only 1 frame (non-animated)

@olivervogel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix. I will include this in the next patch release.

I have a weekly release cycle for patch releases (every Saturday) and a monthly release cycle for minor releases (every 3rd Saturday of the month) for all intervention projects.

@deluxetom
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok perfect! I was actually going to ask you about that :)

Please sign in to comment.