Search code examples
phpmultithreadinglimitvips

Vips library threads limit


How i can limited number of active threads in vips lib from php code? I want to cut big image for tiles but have kill script from hoster for limit of proc i guess.

In web i cant fined good examples for use vips like a php module. I make this code and this is works, but do not have a limits.

$im = vips_image_new_from_file('./big_image.png', ['access' => 'sequential'])["out"];
vips_call('dzsave', $im, './folder', ["overlap" => 0, "tile-size" => 256, "depth" => "one"]);

Solution

  • I found function for this:

    vips_concurrency_set($number_of_threads);
    

    After use 1 or 2 on it (maybe i can use more, i don't try) hosting provider don't kill process but lib work very fast whatever.