function m4music_imagecache_generate($presetname, $filepath) { if (!($preset = imagecache_preset_by_name($presetname))) { return; } $dst = imagecache_create_path($presetname, $filepath); if (!file_exists($dst)) { imagecache_build_derivative($preset['actions'], $filepath, $dst); } return $dst; }
* - $view: The view object * - $field: The field handler object that can process the input * - $row: The raw SQL result that can be used * - $output: The processed output that will normally be used. * * When fetching output from the $row, this construct should be used: * $data = $row->{$field->field_alias} * * The above will guarantee that you'll always get the correct data, * regardless of any changes in the aliasing that might happen if * the view is modified. */ // Shows the islamic posters image. global $base_url; $path= "sites/default/files/islamposters/". $output; $presetname = 'Islam_posters'; $preset = imagecache_preset_by_name($presetname); $src = $path; $dst = imagecache_create_path($presetname, $src); // Ensure existing derivative or try to create it on the fly if (file_exists($dst) || imagecache_build_derivative($preset['actions'], $src, $dst)) { } ?> <div style="width:600px;" align="center"> <a href="<?php print $base_url.'/'.$dst ?> " rel="lightbox"> <img src='<?=$base_url?>/sites/default/files/islamposters/<?php print $output;?>' height="312" width="211" align="absmiddle" border="0" /> </a> </div>
function kr2011_preprocess_node(&$vars) { if ($vars['type'] == 'Article') { if (strlen($vars['field_article_fakta'][0]['value']) > 4) { $vars['fakta'] = $vars['field_article_fakta'][0]['safe']; } if (strlen($vars['field_teaser'][0]['value']) > 2) { $vars['ingress'] = 1; $vars['ingress_value'] = $vars['field_teaser'][0]['safe']; } foreach ($vars['field_sitat'] as $sitatlinje) { $sitater .= '<div class="sitat-line"><span>' . $sitatlinje['value'] . '</span></div>'; if (strlen($sitatlinje['value']) > 2) { $vars['sitat'] = 1; } } $vars['sitat_content'] = '<div class="sitat-wrapper">' . $sitater . '</div>'; $updated = format_date($vars['node']->changed, 'medium'); if ($vars['node']->changed != $vars['node']->created) { $vars['node_updated_rdfa'] = _openpublish_get_rdfa_date($vars['node']->changed, $updated); } // $vars['node_created_rdfa'] = _openpublish_get_rdfa_date($vars['node']->created, $vars['node_created']); // $vars['node_created_rdfa'] .= _openpublish_get_rdfa_date($vars['node']->updated, $updated); drupal_add_js(drupal_get_path('theme', 'kr2011') . '/js/kr2011.js', 'theme', 'footer'); // print_R($vars['node']); } elseif ($vars['type'] == 'bildegalleri') { drupal_add_js(drupal_get_path('theme', 'kr2011') . '/flex/jquery.min.js'); drupal_add_js(drupal_get_path('theme', 'kr2011') . '/flex/jquery-noconflict.js'); drupal_add_js(drupal_get_path('theme', 'kr2011') . '/flex/jquery.flexslider.js', 'theme', 'header'); drupal_add_js(drupal_get_path('theme', 'kr2011') . '/flex/jquery.colorbox.js', 'theme', 'header'); drupal_add_css(drupal_get_path('theme', 'kr2011') . '/flex/flexslider.css'); drupal_add_css(drupal_get_path('theme', 'kr2011') . '/flex/kr-flex.css'); drupal_add_css(drupal_get_path('theme', 'kr2011') . '/flex/colorbox.css'); drupal_add_js(drupal_get_path('theme', 'kr2011') . '/flex/bilde.js', 'theme', 'header'); $hidden = '<div class="colorbox-images-container">'; $html = '<div class="flexslider"> <ul class="slides">'; foreach ($vars['field_galleri_bilde'] as $delta => $item) { $html .= '<li>'; $html .= '<a class="colorboks1" href="#bilde_' . $vars['nid'] . '_' . $delta . '">'; $html .= $item['view']; if ($vars['field_galleri_desc'][$delta]['safe'] && $vars['field_galleri_kredit'][$delta]['safe']) { $html .= '<p>' . $vars['field_galleri_desc'][$delta]['safe']; $html .= '<span class="kredit">' . $vars['field_galleri_kredit'][$delta]['safe'] . '</span></p>'; } elseif ($vars['field_galleri_desc'][$delta]['safe']) { $html .= '<p>' . $vars['field_galleri_desc'][$delta]['safe'] . '</p>'; } elseif ($vars['field_galleri_kredit'][$delta]['safe']) { $html .= '<p><span class="kredit">' . $vars['field_galleri_kredit'][$delta]['safe'] . '</span></p>'; } $html .= '</a>'; $html .= '</li>'; $image = image_get_info(imagecache_create_path('slider_stort', $vars['field_galleri_bilde'][$delta]['filepath'])); //<img src="'.imagecache_create_path('slider_stort', $vars['field_galleri_bilde'][$delta]['filepath']).'"> $hidden .= '<div id="bilde_' . $vars['nid'] . '_' . $delta . '" class="cimage"> ' . theme_imagecache('slider_stort', $vars['field_galleri_bilde'][$delta]['filepath']) . ' <div class="caption">' . $vars['field_galleri_desc'][$delta]['safe'] . '</div> </div>'; } $html .= '</ul></div>'; $hidden .= '</div>'; $vars['content'] = $html; $vars['content'] .= $hidden; } elseif ($vars['type'] == 'eksternt_blogginnlegg') { $blogcontent = node_load($vars['nid']); $blog = node_load($blogcontent->feeds_node_item->feed_nid); $html = '<div class="bloginfo">'; $html .= '<div class="section-date-author">'; $date_label = date('d. ', $blogcontent->created) . t(date('M', $blogcontent->created)) . date(' Y - H:i', $blogcontent->created); $html .= _openpublish_get_rdfa_date($blogcontent->created, $date_label); $html .= ' | Fra bloggen: ' . l($blog->title, 'node/' . $blog->nid); $html .= '</div></div>'; $html2 = '<div class="bloggfooter">Dette blogginnlegget er hentet fra: ' . l($blogcontent->feeds_node_item->url, $blogcontent->feeds_node_item->url) . '</div>'; $vars['content'] = $html . $vars['content'] . $html2; } }
function beats_imagecache($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) { if((in_array($presetname, array('user_avatar','48x48','189x245' , 'celebrity_80x80' )) || !$presetname) && (!file_exists($path) || !$path)){ $path = drupal_get_path('theme','3beats').'/images/defaults_img.png'; } // Check is_null() so people can intentionally pass an empty array of // to override the defaults completely. if (is_null($attributes)) { $attributes = array('class' => 'imagecache imagecache-'. $presetname); } if ($getsize && ($image = image_get_info(imagecache_create_path($presetname, $path)))) { $attributes['width'] = $image['width']; $attributes['height'] = $image['height']; } $attributes = drupal_attributes($attributes); $imagecache_url = $presetname ? imagecache_create_url($presetname, $path) : $path; return '<img src="'. $imagecache_url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />'; }