Forum Moderators: coopster

Message Too Old, No Replies

Tim thumb add correct width height attributes

         

cheaperholidays

12:15 pm on Nov 2, 2011 (gmt 0)

10+ Year Member



Hi all


Sorry to bother you, but how can i amend this string -

timthumb.php?zc=1&width='105'&height='85'&src='); ?> to add width='105' height='85' to the src=


The script currently outputs as below

/timthumb.php?zc=1&width='105'&height='85'&src=/travel/wp-content/uploads/2011/08/irene-300x231.jpg.

But ideally needs to be -

/scripts/timthumb.php?zc=1&width='105'&height='85'&src=/travel/wp-content/uploads/2011/08/irene-300x231.jpg width='105' height='85'


Many thanks in advance.


Mike

cheaperholidays

8:07 pm on Nov 2, 2011 (gmt 0)

10+ Year Member



Is this not on perhaps?

coopster

12:04 pm on Nov 3, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Or perhaps nobody uses timthumb ;)
You will need to locate where that urlencoded string is being put together in the script and modify it accordingly. It looks like you already have the variables because they are pushed out in the front part of the urlencoded string so just append them with the properly spaced formatting to the end of your "src" attribute, just as you demonstrated in your example.

cheaperholidays

12:07 pm on Nov 5, 2011 (gmt 0)

10+ Year Member



Ok but how do i do that

timthumb.php?zc=1&width='105'&height='85'&src='); ?> the sizes wil be hard coded as width='105' height='85'

But i cannot for the life of me add the sizes to the end of the src='

php echo get_post_image (get_the_id(), '', '', '' .get_bloginfo('template_url') .'/scripts/timthumb.php?zc=1&width='105'&height='85'&src='); ?>

cheaperholidays

12:13 pm on Nov 6, 2011 (gmt 0)

10+ Year Member



This partialy worked but missed some image thumb nails



<?php





02

if ($images = get_children(array(





03

'post_type' => 'attachment',





04

'numberposts' => 1,





05

'post_status' => null,





06

'post_parent' => $post->ID,)))





07







08

foreach($images as $image) {





09

$attachment=wp_get_attachment_image_src($image->ID, $size);





10

?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $attachment[0]; ?>" alt="<?php the_title(); ?>" /></a>





11

<?php } else { ?>





12

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/preview.jpg" alt=""/></a>





13

<?php } ?>