set_time_limit(0);
$products = \Product\Model::query()->get();
foreach( $products as $key=>$product )
{
\Log::debug( $product->sku );
echo $product->sku;
$images = $product->images();
foreach( $images as $image )
{
$image->thumbnail() . '<br>';
}
unset($products[$key]);
unset($images);
}
public function action_test()
{
set_time_limit(0);
$limit = 10;
$offset=0;
while( $products = \Product\Model::query()
->limit($limit)
->offset($offset)
->get()
)
{
gc_collect_cycles();
foreach( $products as $key=>$product )
{
echo $product->sku . '<br/>';
\Log::debug( $product->sku );
$images = $product->images();
foreach( $images as $image )
{
//$image->thumbnail();
}
}
$offset += $limit;
}
exit;
}
public function action_test()
{
set_time_limit(0);
$i=0;
$limit = 900;
$offset=0;
$products = \DB::select('sku')
->from('dg_product')
->limit($limit)
->offset($offset)
->execute()
->as_array()
;
foreach( $products as $key=>$product )
{
echo $product['sku'] . '<br/>';
//\Log::debug( $product['sku'] );
$images = \Thumb::load_dir("product/{$product['sku']}/");
foreach( $images as $image )
{
//$image->thumbnail();
$i++;
if( $i % 10 == 0 )
{
\Log::debug($i);
}
}
}
exit;
}
Profiler::mark_memory(false, 'before Thumb::load_dir');so you can see if that is responsible for the increase in used memory? (if you don't use the profiler, you have to write the value of memory_get_usage() to the Log).$images = \Thumb::load_dir("product/{$product['sku']}/");
Profiler::mark_memory(false, 'after Thumb::load_dir');
It looks like you're new here. If you want to get involved, click one of these buttons!