Image handling in WordPress is pretty snazzy….
As you can see there, I have a few options. I can show one of three things: either a thumbnail, the full image, or the title of the image. The title of the image is a mystery to me when you might use that, but here on Needcoffee we do normally the full size image. Every so often though, and that Lost in Space robot post is the most recent example, there’s an image where we don’t want to shrink it–we want people to be able to access it full size. So you can see the thumbnail on the post.
Once you’ve got the image, you’ve got three choices for what it does. You can either link to the file, link to a page, or no link at all. Normally we do full size and no link. But as in the Lost in Space post, we want to link out to a page that contains the full image.
Trouble is, if you do something that’s too big, it will resize the image and then you have to click through the image on the page again to get to the full image. What a pain in the ass. And even worse, nobody seems to be able to say where to fix this, they just hem and haw around the question. As always.
Sokay. You can change it. Open up your *whateveryoursiteis*/wp-includes/post-template.php file.
Look for this code:
function prepend_attachment($content) {
$p = '
';
$p = apply_filters('prepend_attachment', $p);
return "$p\n$content";
}
That 400 and 300 are the maximum width and heighth respectively that WordPress will allow. All you have to do is change them and you should be set.
Now–the thing to bear in mind is to make sure that you don’t break your theme. On Needcoffee, our content area is about 600 pixels wide, so if you see your theme suddenly get a bit bloated in the middle, you know you’ve put too big an image out there.
Questions? Comment away.
I think there’s a better way to do this on a theme by creating a attachment.php in your theme folder O_O
Mummy: Well, this post was from 2008…I don’t know that the attachment.php was around at that point. Or if it was, it was so poorly documented that I had to result to this. So.