Google AMP's latest thumbnail creation is vastly improved!


I have been playing with the latest AmpProject's image creation parameters and delighted with the results.

It is no longer necessary to create thumbnails because AMP original images can be shrunk to the containing folder and without having to specify any image dimensions!

I created about a hundred thumbnails both from the thumbnails and the original images and the rendering difference is negligible!

The work is in progress and I have to sort out how to align the thumbnails :frowning:
Script to obtain an array of thumbnails:

	$path = $_SERVER['DOCUMENT_ROOT'] .'/subs/thumb/*.*';	
	$imgs = glob($path);
	$imgs = array_slice($imgs, mt_rand(0,88), 101);

Functiont to display thumbnail:

function thumbnail($img, $title='Yes we have no title')	
	$result = <<< ____TMP
		<div class="dib thb contain cll fll">
					class  = "contain"
			    layout = "fill"

	return $result;	

HTML Script to display thumbnails:

<div class="tac">
    $path = '/var/www/ORIGINAL-IMAGES/';
	$len  = strlen( $path );
	foreach( $imgs as $id => $img):
  	  $title  = substr($img, $len);
	  $img    = '' 
		      .  $title;
	  echo thumbnail($img, $title);	

Can you remember the good old days when thumbnails had to be created and the effort involved trying to render the images :slight_smile:

Reserve space and keep aspect ratio of not loaded yet images for responsive design
closed #2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.