Hi there,
I have an issue with thumbnails being generated by timthumb. The images do not show at all with an absolute URL, however if I make them a relative URL using firebug they show up.
This is how the URL's currently show:
http://mydomain.com/wp-content/themes/DK-v1-3/dk/timthumb.php?src=http://mydomain.com/wp-content/uploads/2012/01/SUM201201.jpg&h=260&w=260&zc=1
This is how they need to be to show the images:
http://mydomain.com/wp-content/themes/DK-v1-3/dk/timthumb.php?src=/wp-content/uploads/2012/01/SUM201201.jpg&h=260&w=260&zc=1
Does anyone know a way of getting this to work? I've tried changing permissions etc but that hasn't helped and I've looked high and low to try and find a way to change the URL paths for Timthumb but have had no luck.
Thank you!
Jk.
Template file that is using Timthumb:
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery 3 Columns
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (TEMPLATEPATH . "/templates/template-password.php");
exit;
}
}
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );
get_header(); ?>
<?php
$bg_style = get_post_meta($current_page_id, 'page_bg_style', true);
if($bg_style == 'Static Image')
{
if(has_post_thumbnail($current_page_id, 'full'))
{
$image_id = get_post_thumbnail_id($current_page_id);
$image_thumb = wp_get_attachment_image_src($image_id, 'full', true);
$pp_page_bg = $image_thumb[0];
}
else
{
$pp_page_bg = get_stylesheet_directory_uri().'/example/bg.jpg';
}
?>
<script type="text/javascript">
jQuery.backstretch( "<?php echo $pp_page_bg; ?>", {speed: 'slow'} );
</script>
<?php
} // end if static image
else
{
$page_bg_gallery_id = get_post_meta($current_page_id, 'page_bg_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $page_bg_gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$bg_photo_arr = get_posts( $args );
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.3.1.3.js"></script>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.shutter.js"></script>
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
random : 0, //Randomize slide order (Ignores start slide)
slide_interval : 10000, //Length between transitions
<?php
$pp_homepage_slideshow_trans = get_option('pp_homepage_slideshow_trans');
if(empty($pp_homepage_slideshow_trans))
{
$pp_homepage_slideshow_trans = 1;
}
?>
transition : <?php echo $pp_homepage_slideshow_trans; ?>, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 0, //Disables image dragging and right click with Javascript
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
<?php
$pp_enable_fit_image = get_option('pp_enable_fit_image');
if(empty($pp_enable_fit_image))
{
$pp_enable_fit_image = 1;
}
else
{
$pp_enable_fit_image = 0;
}
?>
fit_portrait : <?php echo $pp_enable_fit_image; ?>, //Portrait images will not exceed browser height
fit_landscape : <?php echo $pp_enable_fit_image; ?>, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 0, //Thumbnail navigation
slide_counter : 0, //Display slide numbers
slide_captions : 0, //Slide caption (Pull from "title" in slides array)
progress_bar : 1,
slides : [ //Slideshow Images
<?php
foreach($bg_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h=80&w=130&zc=1';
}
?>
<?php $homeslides .= '{image : \''.$image_url[0].'\', thumb: \''.$small_image_url.'\', title: "<div id=\"gallery_title\">'.$photo->post_title.'</div><div id=\"gallery_desc\">'.$photo->post_content.'</div>"},'; ?>
<?php
}
?>
<?php $homeslides = substr($homeslides,0,-1);
echo $homeslides; ?> ]
});
});
</script>
<!--Time Bar-->
<div id="progress-back" class="load-item">
<div id="progress-bar"></div>
</div>
<div id="thumb-tray" class="load-item">
<div id="thumb-back"></div>
<div id="thumb-forward"></div>
</div>
<!--Control Bar-->
<div id="controls-wrapper" class="load-item">
<div id="controls">
<!--Arrow Navigation-->
<a id="prevslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_prev.png" alt=""/></a>
<a id="play-button"><img id="pauseplay" src="<?php echo get_stylesheet_directory_uri(); ?>/images/pause.png" alt=""></a>
<a id="nextslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_next.png" alt=""/></a>
<!--Thumb Tray button-->
<a id="tray-button"><img id="tray-arrow" src="<?php echo get_stylesheet_directory_uri(); ?>/images/button-tray-up.png" alt=""/></a>
</div>
</div>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
}
?>
<?php
if(!empty($all_photo_arr))
{
?>
<!-- Begin content -->
<div id="page_content_wrapper">
<?php
$pp_gallery_width = 260;
$pp_gallery_height = 260;
?>
<div class="inner">
<div class="inner_wrapper">
<div id="page_caption" class="sidebar_content full_width" style="padding-bottom:0">
<div style="float:left">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>
<div class="page_control">
<a id="page_minimize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_minus.png" alt=""/>
</a>
<a id="page_maximize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_plus.png" alt=""/>
</a>
</div>
</div>
<div class="sidebar_content full_width">
<?php
if(!empty($post->post_content))
{
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/>
<?php
}
?>
<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h='.$pp_gallery_height.'&w='.$pp_gallery_width.'&zc=1';
}
$last_class = '';
if(($key+1)%3==0)
{
$last_class = 'last';
}
?>
<div class="one_third <?php echo $last_class; ?> gallery3" style="margin-top:3%">
<?php
if(!empty($small_image_url))
{
?>
<div class="shadow">
<div class="zoom"><?php _e( 'Enlarge', THEMEDOMAIN ); ?></div>
</div>
<a rel="gallery" href="<?php echo $image_url[0]; ?>">
<img src="<?php echo $small_image_url; ?>" alt="" class="one_third_img"/>
</a>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<br class="clear"/>
<?php get_footer(); ?>
</div>
<!-- End content -->
<?php
}
?>
<br class="clear"/>
</div>
Francisco Javier Carazo Gil answers:
Hi Jkendall,
Look at it:
// this is the absolute path
$url = 'http://domain.com/wp-content/themes/joorang/wp-content/uploads/2011/01/img.jpg';
// convert it into relative path
$url = str_replace(get_bloginfo('url'), '', $url);
// get the image url, resized by timthumb
$timthumb_url = get_stylesheet_directory_uri() . "/timthumb.php?src=$url&w=80&h=80";
Francisco Javier Carazo Gil comments:
You have to use this code, just before you call timthumb.php.
Share the code and I tell you in a moment.
Francisco Javier Carazo Gil comments:
Just before here:
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h=80&w=130&zc=1';
It appears twice.
Francisco Javier Carazo Gil comments:
Here the complete code :)
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery 3 Columns
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (TEMPLATEPATH . "/templates/template-password.php");
exit;
}
}
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );
get_header(); ?>
<?php
$bg_style = get_post_meta($current_page_id, 'page_bg_style', true);
if($bg_style == 'Static Image')
{
if(has_post_thumbnail($current_page_id, 'full'))
{
$image_id = get_post_thumbnail_id($current_page_id);
$image_thumb = wp_get_attachment_image_src($image_id, 'full', true);
$pp_page_bg = $image_thumb[0];
}
else
{
$pp_page_bg = get_stylesheet_directory_uri().'/example/bg.jpg';
}
?>
<script type="text/javascript">
jQuery.backstretch( "<?php echo $pp_page_bg; ?>", {speed: 'slow'} );
</script>
<?php
} // end if static image
else
{
$page_bg_gallery_id = get_post_meta($current_page_id, 'page_bg_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $page_bg_gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$bg_photo_arr = get_posts( $args );
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.3.1.3.js"></script>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.shutter.js"></script>
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
random : 0, //Randomize slide order (Ignores start slide)
slide_interval : 10000, //Length between transitions
<?php
$pp_homepage_slideshow_trans = get_option('pp_homepage_slideshow_trans');
if(empty($pp_homepage_slideshow_trans))
{
$pp_homepage_slideshow_trans = 1;
}
?>
transition : <?php echo $pp_homepage_slideshow_trans; ?>, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 0, //Disables image dragging and right click with Javascript
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
<?php
$pp_enable_fit_image = get_option('pp_enable_fit_image');
if(empty($pp_enable_fit_image))
{
$pp_enable_fit_image = 1;
}
else
{
$pp_enable_fit_image = 0;
}
?>
fit_portrait : <?php echo $pp_enable_fit_image; ?>, //Portrait images will not exceed browser height
fit_landscape : <?php echo $pp_enable_fit_image; ?>, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 0, //Thumbnail navigation
slide_counter : 0, //Display slide numbers
slide_captions : 0, //Slide caption (Pull from "title" in slides array)
progress_bar : 1,
slides : [ //Slideshow Images
<?php
foreach($bg_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$image_url[0] = str_replace(get_bloginfo('url'), '', $image_url[0]);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h=80&w=130&zc=1';
}
?>
<?php $homeslides .= '{image : \''.$image_url[0].'\', thumb: \''.$small_image_url.'\', title: "<div id=\"gallery_title\">'.$photo->post_title.'</div><div id=\"gallery_desc\">'.$photo->post_content.'</div>"},'; ?>
<?php
}
?>
<?php $homeslides = substr($homeslides,0,-1);
echo $homeslides; ?> ]
});
});
</script>
<!--Time Bar-->
<div id="progress-back" class="load-item">
<div id="progress-bar"></div>
</div>
<div id="thumb-tray" class="load-item">
<div id="thumb-back"></div>
<div id="thumb-forward"></div>
</div>
<!--Control Bar-->
<div id="controls-wrapper" class="load-item">
<div id="controls">
<!--Arrow Navigation-->
<a id="prevslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_prev.png" alt=""/></a>
<a id="play-button"><img id="pauseplay" src="<?php echo get_stylesheet_directory_uri(); ?>/images/pause.png" alt=""></a>
<a id="nextslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_next.png" alt=""/></a>
<!--Thumb Tray button-->
<a id="tray-button"><img id="tray-arrow" src="<?php echo get_stylesheet_directory_uri(); ?>/images/button-tray-up.png" alt=""/></a>
</div>
</div>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
}
?>
<?php
if(!empty($all_photo_arr))
{
?>
<!-- Begin content -->
<div id="page_content_wrapper">
<?php
$pp_gallery_width = 260;
$pp_gallery_height = 260;
?>
<div class="inner">
<div class="inner_wrapper">
<div id="page_caption" class="sidebar_content full_width" style="padding-bottom:0">
<div style="float:left">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>
<div class="page_control">
<a id="page_minimize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_minus.png" alt=""/>
</a>
<a id="page_maximize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_plus.png" alt=""/>
</a>
</div>
</div>
<div class="sidebar_content full_width">
<?php
if(!empty($post->post_content))
{
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/>
<?php
}
?>
<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$image_url[0] = str_replace(get_bloginfo('url'), '', $image_url[0]);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h='.$pp_gallery_height.'&w='.$pp_gallery_width.'&zc=1';
}
$last_class = '';
if(($key+1)%3==0)
{
$last_class = 'last';
}
?>
<div class="one_third <?php echo $last_class; ?> gallery3" style="margin-top:3%">
<?php
if(!empty($small_image_url))
{
?>
<div class="shadow">
<div class="zoom"><?php _e( 'Enlarge', THEMEDOMAIN ); ?></div>
</div>
<a rel="gallery" href="<?php echo $image_url[0]; ?>">
<img src="<?php echo $small_image_url; ?>" alt="" class="one_third_img"/>
</a>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<br class="clear"/>
<?php get_footer(); ?>
</div>
<!-- End content -->
<?php
}
?>
<br class="clear"/>
</div>
Jkendall comments:
Thanks Francisco, that made the thumbs work - however they link to a lightbox pop which now does not work.
Can you see what might allow the lightbox url remain as an absolute URL but keep the thumbs as relative URLs?
Almost there!
Francisco Javier Carazo Gil comments:
Fix it. Try now.
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery 3 Columns
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (TEMPLATEPATH . "/templates/template-password.php");
exit;
}
}
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );
get_header(); ?>
<?php
$bg_style = get_post_meta($current_page_id, 'page_bg_style', true);
if($bg_style == 'Static Image')
{
if(has_post_thumbnail($current_page_id, 'full'))
{
$image_id = get_post_thumbnail_id($current_page_id);
$image_thumb = wp_get_attachment_image_src($image_id, 'full', true);
$pp_page_bg = $image_thumb[0];
}
else
{
$pp_page_bg = get_stylesheet_directory_uri().'/example/bg.jpg';
}
?>
<script type="text/javascript">
jQuery.backstretch( "<?php echo $pp_page_bg; ?>", {speed: 'slow'} );
</script>
<?php
} // end if static image
else
{
$page_bg_gallery_id = get_post_meta($current_page_id, 'page_bg_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $page_bg_gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$bg_photo_arr = get_posts( $args );
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.3.1.3.js"></script>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.shutter.js"></script>
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
random : 0, //Randomize slide order (Ignores start slide)
slide_interval : 10000, //Length between transitions
<?php
$pp_homepage_slideshow_trans = get_option('pp_homepage_slideshow_trans');
if(empty($pp_homepage_slideshow_trans))
{
$pp_homepage_slideshow_trans = 1;
}
?>
transition : <?php echo $pp_homepage_slideshow_trans; ?>, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 0, //Disables image dragging and right click with Javascript
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
<?php
$pp_enable_fit_image = get_option('pp_enable_fit_image');
if(empty($pp_enable_fit_image))
{
$pp_enable_fit_image = 1;
}
else
{
$pp_enable_fit_image = 0;
}
?>
fit_portrait : <?php echo $pp_enable_fit_image; ?>, //Portrait images will not exceed browser height
fit_landscape : <?php echo $pp_enable_fit_image; ?>, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 0, //Thumbnail navigation
slide_counter : 0, //Display slide numbers
slide_captions : 0, //Slide caption (Pull from "title" in slides array)
progress_bar : 1,
slides : [ //Slideshow Images
<?php
foreach($bg_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$image_url[0] = str_replace(get_bloginfo('url'), '', $image_url[0]);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h=80&w=130&zc=1';
}
?>
<?php
$image_url[0] = str_replace(get_bloginfo('url'), '', $image_url[0]);
$homeslides .= '{image : \''.$image_url[0].'\', thumb: \''.$small_image_url.'\', title: "<div id=\"gallery_title\">'.$photo->post_title.'</div><div id=\"gallery_desc\">'.$photo->post_content.'</div>"},'; ?>
<?php
}
?>
<?php $homeslides = substr($homeslides,0,-1);
echo $homeslides; ?> ]
});
});
</script>
<!--Time Bar-->
<div id="progress-back" class="load-item">
<div id="progress-bar"></div>
</div>
<div id="thumb-tray" class="load-item">
<div id="thumb-back"></div>
<div id="thumb-forward"></div>
</div>
<!--Control Bar-->
<div id="controls-wrapper" class="load-item">
<div id="controls">
<!--Arrow Navigation-->
<a id="prevslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_prev.png" alt=""/></a>
<a id="play-button"><img id="pauseplay" src="<?php echo get_stylesheet_directory_uri(); ?>/images/pause.png" alt=""></a>
<a id="nextslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_next.png" alt=""/></a>
<!--Thumb Tray button-->
<a id="tray-button"><img id="tray-arrow" src="<?php echo get_stylesheet_directory_uri(); ?>/images/button-tray-up.png" alt=""/></a>
</div>
</div>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
}
?>
<?php
if(!empty($all_photo_arr))
{
?>
<!-- Begin content -->
<div id="page_content_wrapper">
<?php
$pp_gallery_width = 260;
$pp_gallery_height = 260;
?>
<div class="inner">
<div class="inner_wrapper">
<div id="page_caption" class="sidebar_content full_width" style="padding-bottom:0">
<div style="float:left">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>
<div class="page_control">
<a id="page_minimize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_minus.png" alt=""/>
</a>
<a id="page_maximize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_plus.png" alt=""/>
</a>
</div>
</div>
<div class="sidebar_content full_width">
<?php
if(!empty($post->post_content))
{
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/>
<?php
}
?>
<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$image_url[0] = str_replace(get_bloginfo('url'), '', $image_url[0]);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h='.$pp_gallery_height.'&w='.$pp_gallery_width.'&zc=1';
}
$last_class = '';
if(($key+1)%3==0)
{
$last_class = 'last';
}
?>
<div class="one_third <?php echo $last_class; ?> gallery3" style="margin-top:3%">
<?php
if(!empty($small_image_url))
{
?>
<div class="shadow">
<div class="zoom"><?php _e( 'Enlarge', THEMEDOMAIN ); ?></div>
</div>
<a rel="gallery" href="<?php echo $image_url[0]; ?>">
<img src="<?php echo $small_image_url; ?>" alt="" class="one_third_img"/>
</a>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<br class="clear"/>
<?php get_footer(); ?>
</div>
<!-- End content -->
<?php
}
?>
<br class="clear"/>
</div>
Julio Potier answers:
Hello
Can you paste the code using the timthumb.php file ?
<em>The goal is to simply replace "http://mydomain.com/" by "".</em>
<em>Example :</em>
<?php
//Original
$tt_url = get_template_directory_uri() . 'dk/timthumb.php';
//New
$tt_url = str_replace( 'http://mydomain.com/', '', $tt_url );
?>
Thank you
Jkendall comments:
<blockquote>Can you paste the code using the timthumb.php file ?</blockquote>
Hi Julio - just to clarify are saying to add the code below to the timthumb.php file?
<?php
//Original
$tt_url = get_template_directory_uri() . 'dk/timthumb.php';
//New
$tt_url = str_replace( 'http://mydomain.com/', '', $tt_url );
?>
Julio Potier comments:
Maybe yes, can you share me the code which use the timthumb.php file ?
is it a plugin ? your theme ? do you know which file is using it ? I can help you to find it if you need (with FTP acces of course)
See you soon
Julio Potier comments:
Try this :
$prefix = str_replace( home_url(), '', get_stylesheet_directory_uri() );
$small_image_url = $prefix . '/timthumb.php?src='.$image_url[0].'&h=80&w=130&zc=1';
Julio Potier comments:
Full code :
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery 3 Columns
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (TEMPLATEPATH . "/templates/template-password.php");
exit;
}
}
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );
get_header(); ?>
<?php
$bg_style = get_post_meta($current_page_id, 'page_bg_style', true);
if($bg_style == 'Static Image')
{
if(has_post_thumbnail($current_page_id, 'full'))
{
$image_id = get_post_thumbnail_id($current_page_id);
$image_thumb = wp_get_attachment_image_src($image_id, 'full', true);
$pp_page_bg = $image_thumb[0];
}
else
{
$pp_page_bg = get_stylesheet_directory_uri().'/example/bg.jpg';
}
?>
<script type="text/javascript">
jQuery.backstretch( "<?php echo $pp_page_bg; ?>", {speed: 'slow'} );
</script>
<?php
} // end if static image
else
{
$page_bg_gallery_id = get_post_meta($current_page_id, 'page_bg_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $page_bg_gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$bg_photo_arr = get_posts( $args );
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.3.1.3.js"></script>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.shutter.js"></script>
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
random : 0, //Randomize slide order (Ignores start slide)
slide_interval : 10000, //Length between transitions
<?php
$pp_homepage_slideshow_trans = get_option('pp_homepage_slideshow_trans');
if(empty($pp_homepage_slideshow_trans))
{
$pp_homepage_slideshow_trans = 1;
}
?>
transition : <?php echo $pp_homepage_slideshow_trans; ?>, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 0, //Disables image dragging and right click with Javascript
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
<?php
$pp_enable_fit_image = get_option('pp_enable_fit_image');
if(empty($pp_enable_fit_image))
{
$pp_enable_fit_image = 1;
}
else
{
$pp_enable_fit_image = 0;
}
?>
fit_portrait : <?php echo $pp_enable_fit_image; ?>, //Portrait images will not exceed browser height
fit_landscape : <?php echo $pp_enable_fit_image; ?>, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 0, //Thumbnail navigation
slide_counter : 0, //Display slide numbers
slide_captions : 0, //Slide caption (Pull from "title" in slides array)
progress_bar : 1,
slides : [ //Slideshow Images
<?php
foreach($bg_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$prefix = str_replace( home_url(), '', get_stylesheet_directory_uri() );
$small_image_url = $prefix . '/timthumb.php?src='.$image_url[0].'&h=80&w=130&zc=1';
}
?>
<?php $homeslides .= '{image : \''.$image_url[0].'\', thumb: \''.$small_image_url.'\', title: "<div id=\"gallery_title\">'.$photo->post_title.'</div><div id=\"gallery_desc\">'.$photo->post_content.'</div>"},'; ?>
<?php
}
?>
<?php $homeslides = substr($homeslides,0,-1);
echo $homeslides; ?> ]
});
});
</script>
<!--Time Bar-->
<div id="progress-back" class="load-item">
<div id="progress-bar"></div>
</div>
<div id="thumb-tray" class="load-item">
<div id="thumb-back"></div>
<div id="thumb-forward"></div>
</div>
<!--Control Bar-->
<div id="controls-wrapper" class="load-item">
<div id="controls">
<!--Arrow Navigation-->
<a id="prevslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_prev.png" alt=""/></a>
<a id="play-button"><img id="pauseplay" src="<?php echo get_stylesheet_directory_uri(); ?>/images/pause.png" alt=""></a>
<a id="nextslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_next.png" alt=""/></a>
<!--Thumb Tray button-->
<a id="tray-button"><img id="tray-arrow" src="<?php echo get_stylesheet_directory_uri(); ?>/images/button-tray-up.png" alt=""/></a>
</div>
</div>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
}
?>
<?php
if(!empty($all_photo_arr))
{
?>
<!-- Begin content -->
<div id="page_content_wrapper">
<?php
$pp_gallery_width = 260;
$pp_gallery_height = 260;
?>
<div class="inner">
<div class="inner_wrapper">
<div id="page_caption" class="sidebar_content full_width" style="padding-bottom:0">
<div style="float:left">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>
<div class="page_control">
<a id="page_minimize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_minus.png" alt=""/>
</a>
<a id="page_maximize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_plus.png" alt=""/>
</a>
</div>
</div>
<div class="sidebar_content full_width">
<?php
if(!empty($post->post_content))
{
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/>
<?php
}
?>
<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$prefix = str_replace( home_url(), '', get_stylesheet_directory_uri() );
$small_image_url = $prefix . '/timthumb.php?src='.$image_url[0].'&h='.$pp_gallery_height.'&w='.$pp_gallery_width.'&zc=1';
}
$last_class = '';
if(($key+1)%3==0)
{
$last_class = 'last';
}
?>
<div class="one_third <?php echo $last_class; ?> gallery3" style="margin-top:3%">
<?php
if(!empty($small_image_url))
{
?>
<div class="shadow">
<div class="zoom"><?php _e( 'Enlarge', THEMEDOMAIN ); ?></div>
</div>
<a rel="gallery" href="<?php echo $image_url[0]; ?>">
<img src="<?php echo $small_image_url; ?>" alt="" class="one_third_img"/>
</a>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<br class="clear"/>
<?php get_footer(); ?>
</div>
<!-- End content -->
<?php
}
?>
<br class="clear"/>
</div>
Julio Potier comments:
Here comes a pastebin link if you prefer :
[[LINK href="http://pastebin.com/G5WVxtXK"]]http://pastebin.com/G5WVxtXK[[/LINK]]
Sorry for the double line space, WPQ does this everytime >_<
Fahad Murtaza answers:
Please share the code which uses the timthumb. I can easily modify it to do what you want.
Jkendall comments:
Hi Fahd - I have added the template code above.
Thank you
Jk.
Arnav Joy answers:
try this
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery 3 Columns
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (TEMPLATEPATH . "/templates/template-password.php");
exit;
}
}
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );
get_header(); ?>
<?php
$bg_style = get_post_meta($current_page_id, 'page_bg_style', true);
if($bg_style == 'Static Image')
{
if(has_post_thumbnail($current_page_id, 'full'))
{
$image_id = get_post_thumbnail_id($current_page_id);
$image_thumb = wp_get_attachment_image_src($image_id, 'full', true);
$pp_page_bg = $image_thumb[0];
}
else
{
$pp_page_bg = get_stylesheet_directory_uri().'/example/bg.jpg';
}
?>
<script type="text/javascript">
jQuery.backstretch( "<?php echo $pp_page_bg; ?>", {speed: 'slow'} );
</script>
<?php
} // end if static image
else
{
$page_bg_gallery_id = get_post_meta($current_page_id, 'page_bg_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $page_bg_gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$bg_photo_arr = get_posts( $args );
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.3.1.3.js"></script>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.shutter.js"></script>
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
random : 0, //Randomize slide order (Ignores start slide)
slide_interval : 10000, //Length between transitions
<?php
$pp_homepage_slideshow_trans = get_option('pp_homepage_slideshow_trans');
if(empty($pp_homepage_slideshow_trans))
{
$pp_homepage_slideshow_trans = 1;
}
?>
transition : <?php echo $pp_homepage_slideshow_trans; ?>, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 0, //Disables image dragging and right click with Javascript
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
<?php
$pp_enable_fit_image = get_option('pp_enable_fit_image');
if(empty($pp_enable_fit_image))
{
$pp_enable_fit_image = 1;
}
else
{
$pp_enable_fit_image = 0;
}
?>
fit_portrait : <?php echo $pp_enable_fit_image; ?>, //Portrait images will not exceed browser height
fit_landscape : <?php echo $pp_enable_fit_image; ?>, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 0, //Thumbnail navigation
slide_counter : 0, //Display slide numbers
slide_captions : 0, //Slide caption (Pull from "title" in slides array)
progress_bar : 1,
slides : [ //Slideshow Images
<?php
foreach($bg_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$len = strlen('http://mydomain.com');
$imgURL = substr($image_url[0], $len);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$imgURL.'&h=80&w=130&zc=1';
}
?>
<?php $homeslides .= '{image : \''.$image_url[0].'\', thumb: \''.$small_image_url.'\', title: "<div id=\"gallery_title\">'.$photo->post_title.'</div><div id=\"gallery_desc\">'.$photo->post_content.'</div>"},'; ?>
<?php
}
?>
<?php $homeslides = substr($homeslides,0,-1);
echo $homeslides; ?> ]
});
});
</script>
<!--Time Bar-->
<div id="progress-back" class="load-item">
<div id="progress-bar"></div>
</div>
<div id="thumb-tray" class="load-item">
<div id="thumb-back"></div>
<div id="thumb-forward"></div>
</div>
<!--Control Bar-->
<div id="controls-wrapper" class="load-item">
<div id="controls">
<!--Arrow Navigation-->
<a id="prevslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_prev.png" alt=""/></a>
<a id="play-button"><img id="pauseplay" src="<?php echo get_stylesheet_directory_uri(); ?>/images/pause.png" alt=""></a>
<a id="nextslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_next.png" alt=""/></a>
<!--Thumb Tray button-->
<a id="tray-button"><img id="tray-arrow" src="<?php echo get_stylesheet_directory_uri(); ?>/images/button-tray-up.png" alt=""/></a>
</div>
</div>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
}
?>
<?php
if(!empty($all_photo_arr))
{
?>
<!-- Begin content -->
<div id="page_content_wrapper">
<?php
$pp_gallery_width = 260;
$pp_gallery_height = 260;
?>
<div class="inner">
<div class="inner_wrapper">
<div id="page_caption" class="sidebar_content full_width" style="padding-bottom:0">
<div style="float:left">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>
<div class="page_control">
<a id="page_minimize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_minus.png" alt=""/>
</a>
<a id="page_maximize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_plus.png" alt=""/>
</a>
</div>
</div>
<div class="sidebar_content full_width">
<?php
if(!empty($post->post_content))
{
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/>
<?php
}
?>
<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$image_url[0].'&h='.$pp_gallery_height.'&w='.$pp_gallery_width.'&zc=1';
}
$last_class = '';
if(($key+1)%3==0)
{
$last_class = 'last';
}
?>
<div class="one_third <?php echo $last_class; ?> gallery3" style="margin-top:3%">
<?php
if(!empty($small_image_url))
{
?>
<div class="shadow">
<div class="zoom"><?php _e( 'Enlarge', THEMEDOMAIN ); ?></div>
</div>
<a rel="gallery" href="<?php echo $image_url[0]; ?>">
<img src="<?php echo $small_image_url; ?>" alt="" class="one_third_img"/>
</a>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<br class="clear"/>
<?php get_footer(); ?>
</div>
<!-- End content -->
<?php
}
?>
<br class="clear"/>
</div>
find out
$len = strlen('http://mydomain.com');
and replace with your domain
Arnav Joy comments:
try this just copy and paste this code
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery 3 Columns
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (TEMPLATEPATH . "/templates/template-password.php");
exit;
}
}
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$all_photo_arr = get_posts( $args );
get_header(); ?>
<?php
$bg_style = get_post_meta($current_page_id, 'page_bg_style', true);
if($bg_style == 'Static Image')
{
if(has_post_thumbnail($current_page_id, 'full'))
{
$image_id = get_post_thumbnail_id($current_page_id);
$image_thumb = wp_get_attachment_image_src($image_id, 'full', true);
$pp_page_bg = $image_thumb[0];
}
else
{
$pp_page_bg = get_stylesheet_directory_uri().'/example/bg.jpg';
}
?>
<script type="text/javascript">
jQuery.backstretch( "<?php echo $pp_page_bg; ?>", {speed: 'slow'} );
</script>
<?php
} // end if static image
else
{
$page_bg_gallery_id = get_post_meta($current_page_id, 'page_bg_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $page_bg_gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
$bg_photo_arr = get_posts( $args );
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/supersized.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.3.1.3.js"></script>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/supersized.shutter.js"></script>
<script type="text/javascript">
jQuery(function($){
$.supersized({
//Functionality
slideshow : 1, //Slideshow on/off
autoplay : 1, //Slideshow starts playing automatically
start_slide : 1, //Start slide (0 is random)
random : 0, //Randomize slide order (Ignores start slide)
slide_interval : 10000, //Length between transitions
<?php
$pp_homepage_slideshow_trans = get_option('pp_homepage_slideshow_trans');
if(empty($pp_homepage_slideshow_trans))
{
$pp_homepage_slideshow_trans = 1;
}
?>
transition : <?php echo $pp_homepage_slideshow_trans; ?>, //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed : 500, //Speed of transition
new_window : 1, //Image links open in new window/tab
pause_hover : 0, //Pause slideshow on hover
keyboard_nav : 1, //Keyboard navigation on/off
performance : 1, //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect : 0, //Disables image dragging and right click with Javascript
//Size & Position
min_width : 0, //Min width allowed (in pixels)
min_height : 0, //Min height allowed (in pixels)
vertical_center : 1, //Vertically center background
horizontal_center : 1, //Horizontally center background
<?php
$pp_enable_fit_image = get_option('pp_enable_fit_image');
if(empty($pp_enable_fit_image))
{
$pp_enable_fit_image = 1;
}
else
{
$pp_enable_fit_image = 0;
}
?>
fit_portrait : <?php echo $pp_enable_fit_image; ?>, //Portrait images will not exceed browser height
fit_landscape : <?php echo $pp_enable_fit_image; ?>, //Landscape images will not exceed browser width
//Components
navigation : 1, //Slideshow controls on/off
thumbnail_navigation : 0, //Thumbnail navigation
slide_counter : 0, //Display slide numbers
slide_captions : 0, //Slide caption (Pull from "title" in slides array)
progress_bar : 1,
slides : [ //Slideshow Images
<?php
foreach($bg_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$len = strlen(get_bloginfo('url'));
$imgURL = substr($url, $len);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$imgURL.'&h=80&w=130&zc=1';
}
?>
<?php $homeslides .= '{image : \''.$image_url[0].'\', thumb: \''.$small_image_url.'\', title: "<div id=\"gallery_title\">'.$photo->post_title.'</div><div id=\"gallery_desc\">'.$photo->post_content.'</div>"},'; ?>
<?php
}
?>
<?php $homeslides = substr($homeslides,0,-1);
echo $homeslides; ?> ]
});
});
</script>
<!--Time Bar-->
<div id="progress-back" class="load-item">
<div id="progress-bar"></div>
</div>
<div id="thumb-tray" class="load-item">
<div id="thumb-back"></div>
<div id="thumb-forward"></div>
</div>
<!--Control Bar-->
<div id="controls-wrapper" class="load-item">
<div id="controls">
<!--Arrow Navigation-->
<a id="prevslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_prev.png" alt=""/></a>
<a id="play-button"><img id="pauseplay" src="<?php echo get_stylesheet_directory_uri(); ?>/images/pause.png" alt=""></a>
<a id="nextslide" class="load-item"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_next.png" alt=""/></a>
<!--Thumb Tray button-->
<a id="tray-button"><img id="tray-arrow" src="<?php echo get_stylesheet_directory_uri(); ?>/images/button-tray-up.png" alt=""/></a>
</div>
</div>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
}
?>
<?php
if(!empty($all_photo_arr))
{
?>
<!-- Begin content -->
<div id="page_content_wrapper">
<?php
$pp_gallery_width = 260;
$pp_gallery_height = 260;
?>
<div class="inner">
<div class="inner_wrapper">
<div id="page_caption" class="sidebar_content full_width" style="padding-bottom:0">
<div style="float:left">
<h1 class="cufon"><?php echo $post->post_title; ?></h1>
</div>
<div class="page_control">
<a id="page_minimize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_minus.png" alt=""/>
</a>
<a id="page_maximize" href="#">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon_plus.png" alt=""/>
</a>
</div>
</div>
<div class="sidebar_content full_width">
<?php
if(!empty($post->post_content))
{
?>
<p><?php echo nl2br(stripslashes(html_entity_decode(do_shortcode($post->post_content)))); ?></p>
<br/>
<?php
}
?>
<?php
foreach($all_photo_arr as $key => $photo)
{
$small_image_url = get_stylesheet_directory_uri().'/images/000_70.png';
$hyperlink_url = get_permalink($photo->ID);
if(!empty($photo->guid))
{
$image_url[0] = $photo->guid;
$len = strlen(get_bloginfo('url'));
$imgURL = substr($url, $len);
$small_image_url = get_stylesheet_directory_uri().'/timthumb.php?src='.$imgURL.'&h='.$pp_gallery_height.'&w='.$pp_gallery_width.'&zc=1';
}
$last_class = '';
if(($key+1)%3==0)
{
$last_class = 'last';
}
?>
<div class="one_third <?php echo $last_class; ?> gallery3" style="margin-top:3%">
<?php
if(!empty($small_image_url))
{
?>
<div class="shadow">
<div class="zoom"><?php _e( 'Enlarge', THEMEDOMAIN ); ?></div>
</div>
<a rel="gallery" href="<?php echo $image_url[0]; ?>">
<img src="<?php echo $small_image_url; ?>" alt="" class="one_third_img"/>
</a>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<br class="clear"/>
<?php get_footer(); ?>
</div>
<!-- End content -->
<?php
}
?>
<br class="clear"/>
</div>
Sébastien | French WordpressDesigner answers:
If you want use absolute URL you must add your ltd in the allowed sites
In timthumb.php
Jkendall comments:
Thank you Sebastien - is that to prevent security issues? There seem to be a few with TimThumb
Jk.
Sébastien | French WordpressDesigner comments:
Yes that is to prevent security issues