Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

We have views with multiple cck image fields http://screencast.com/t/UOGxa9Jr6 with 'Group multiple values' And we have a theme function to add the needed classes for a script to display these photos in fancybox

function mytheme_content_view_multiple_field($items, $field, $values) {

  if($field['field_name']=='field_photos_images'){
    $output = '';
     $i = 0;
    foreach ($items as $item){
      if(!empty($item) || $item == '0')
        {
          if($i == 0) {

            $output .= '<p><a class="" data-fancybox-group="thumb"  href="/' . $item . '"><img src="/' . $item . '" alt="" width="200" height="150" /></a></p>';

          }
          else {
            $output .= '<p><a class="hid" data-fancybox-group="thumb"  href="/' . $item . '"><img src="/' . $item . '" alt="" /></a></p>';
          }
          $i++;
        }
    }
    return $output;    
  }
}

each node has many images so it takes some time for the nodes to load, you can see each image load one by one taking about 10 seconds to complete

share|improve this question

1 Answer 1

If you can see the images loading one by one then this doesn't have anything to do with the View rendering slowly.

Slow running PHP generally means you have to wait longer before anything displays, not that individual parts of the page render slowly.

Slow loading images means the file size is large or you have a bad internet connection between you and the server.

You've mentioned that you're using CCK so I assume you're using Drupal 6.

Might I recommend using imagecache to pre-process the images to be scaled on the server to the right dimensions before they are sent to the user.

http://drupal.org/project/imagecache

Instead of printing the image tag directly, setup an imagecache preset in Drupal then you call theme() to generate the image markup.

Example:

<?php
  print theme('imagecache', 'mypresetname', 'path/to/file.jpg');
?>

Documentation on the theme function can be found here: http://drupalcontrib.org/api/drupal/contributions!imagecache!imagecache.module/function/theme_imagecache/6

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.