Anyone able to help?

Discussion in 'PHP' started by CrazedContent, Jul 18, 2008.

  1. #1
    See my website here www.insanegam3r.com

    At the top you see an image of a PSP which is currently a decent size but I have also added images that cover the whole page. Here is the code for what happens.

    <?php if( get_post_meta($post->ID, "thumb", true) ): ?>
    			<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img style="padding:5px 0px 2px 0px;" src="<?php echo get_post_meta($post->ID, "thumb", true); ?>" alt="<?php echo get_post_meta($post->ID, "Theme Name", true); ?> Thumbnail" /></a>
    <?php else: ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img style="float:left;margin:0px 5px 10px 0px;"  src="<?php bloginfo('template_url'); ?>/images/defaultimage.jpg" alt="Default Thumbnail" /></a>
    <?php endif; ?>
    Code (markup):
    I am wondering if anyone knows how to put restrictions on the image size. So if I were to have a bigger image than the box it would resize so it doesn't go over.

    Your help is appreciated. Thanks,
    Ash
     
    CrazedContent, Jul 18, 2008 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you don't mind the aspect ratio getting messed up, you could just put width=XXX height=XXX inside the img tag. Replace XXX with your maximum thumbnail sizes.

    Or you could install a thumbnail plugin, like Get The Image
     
    Cash Nebula, Jul 19, 2008 IP
  3. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #3
    Just were you have the style set for the image...


    you can add...

    this will restrict the image to the width and height you are looking for.
     
    Talker, Jul 19, 2008 IP