Haven't tried this before, but you could write an image field formatter that converts the thumbnail files to inline data URIs, eliminating the separate HTTP requests per image. That adds some overhead to the initial node render, but is probably more performant overall.
Here's a quick implementation. Encoding a thumbnail is almost trivially fast; the biggest performance hit is from generating image style derivatives if they don't exist yet.
/**
* Implements hook_field_formatter_info().
*/
function image_datauri_field_formatter_info() {
$formatters = array(
'image_datauri' => array(
'label' => t('Image Data URI'),
'field types' => array('image'),
),
);
return $formatters;
}
/**
* Implements hook_field_formatter_view().
*/
function image_datauri_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
$style_name = 'thumbnail';
$style = image_style_load($style_name);
foreach ($items as $delta => $item) {
$image_style_path = image_style_path($style_name, $item['uri']);
if (!file_exists($image_style_path)) {
if (!image_style_create_derivative($style, $item['uri'], $image_style_path)) {
continue;
}
}
$encoded_image = base64_encode(file_get_contents($image_style_path));
$data_uri = 'data:' . file_get_mimetype($image_style_path) . ';base64,' . $encoded_image;
$attributes = array(
'src' => $data_uri,
'alt' => (isset($item['alt'])) ? $item['alt'] : NULL,
'title' => (isset($item['title'])) ? $item['title'] : NULL,
);
$element[$delta] = array(
'#markup' => '<img ' . drupal_attributes($attributes) . ' />',
);
}
return $element;
}