Skip to content

Parallelization #4

@thekid

Description

@thekid

Given a sequence of elements I would like to be able to spawn workers and relay work to them.

$thumbs= new Folder('thumbs');
Sequence::of(new IOCollectionIterator('.', true))
  ->filter(new ExtensionEqualsFilter('.jpg'))
  ->each(function($e) use($thumbs) {
    $image= Image::loadFrom(new JpegStreamReader($e->getInputStream()));
    $thumb= Image::create(400, 300);
    $thumb->resampleFrom($image);
    $thumb->saveTo(new JpegStreamWriter((new File($thumbs, $e->getName())->out());
  }))
;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions