PHP Help with hd 50000 images

Asked

Viewed 50 times

0

How to load 50,000 images from a hard drive in php

my code

<?php
$imgdir = '/media/hd-ext/Images/JPG/'; //Minha Pasta
$allowed_types = array('jpeg'); //Tipo de extensao
$dimg = opendir($imgdir);//Abre o Diretorio
while($imgfile = readdir($dimg))
{
  if( in_array(strtolower(substr($imgfile,-3)),$allowed_types) OR
      in_array(strtolower(substr($imgfile,-4)),$allowed_types) )
/*Se o arquivo for uma imagem, adicione-o array*/
  {$a_img[] = $imgfile;}
}
echo "<ul>";

 $totimg = count($a_img);  //Conta o taotal de imagens
//Echo nas imagens dentro do li.
 for($x=0; $x < $totimg; $x++){echo "<li><img src='" . $imgdir . $a_img[$x] . "' /></li>";}
echo "</ul>";
?>

separating by date equal to google photos

Error! loads images but takes 3 days to load all images!

  • 4

    It’s too much for a browser to load and show, you would need to page this list.

1 answer

1

50000 images is an absurd amount of data for a browser to load, do a management to load a certain amount at a time, otherwise the loading of all this in 3 days will be the minimum time spent rs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.