php - Adjust image attribute so I can change src -
<img class="lazy" title="windows 8" alt="windows 8" src="http://b.a.org/sites/default/files/styles/thumbnail/public/category_pictures/windows%20media%20player%20alt.png?itok=nxy-3w5_" href="lazy" data-original="http://b.a.org/sites/default/files/styles/thumbnail/public/category_pictures/windows%20media%20player%20alt.png?itok=nxy-3w5_">
i adjust src can display "/sites/all/themes/s5/images/blank.jpg" rather image url. can me modify below code using in drupal 7's template.php make happen?
function s5_preprocess_image(&$variables) { if ($variables['style_name'] == 'thumbnail') { $variables['attributes']['class'][] = 'lazy'; $variables['attributes']['data-original'][] = file_create_url($variables['path']); }}
thanks much!!
added line bottom of "if" block:
function s5_preprocess_image(&$variables) { if ($variables['style_name'] == 'thumbnail') { $variables['attributes']['class'][] = 'lazy'; $variables['attributes']['data-original'][] = file_create_url($variables['path']); $variables['path'] = '/sites/all/themes/s5/images/blank.jpg'; } }
Comments
Post a Comment