Help Getting Images to Display With Attachment.php
I just found out about and added attachment.php so that when I link an image to a page it uses the attachment.php template and displays the image in its full size.
The problem I am having is that I can link images fine and when you click them it pulls the attachment.php template fine, but the image is missing!
Is there a simple call function to pull up the image that I am missing? My current template is very simple,
<?php the_content(); ?>
What am I missing here?
No luck 🙁
Any other ideas? I even tried copying my whole index.php but that didn’t work either. There has to be a tag that I am missing that displays the full image.
Ok found coding via google search to make the image atleast appear and fairly large just not full size and I think if I tweak this it will work just dont know what to tweak,
<?php $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800)); // This also populates the iconsize for the next line ?>
<?php $_post = &get_post($post->ID); $classname = ($_post->iconsize <= 128 ? ‘small’ : ”) . ‘attachment’; // This lets us style narrow icons specially ?>
GOT IT TO DISPLAY FULL SIZE
Only problem is the image is still a LINK to the original image location,
<?php $attachment_link = get_the_attachment_link($post->ID, true, array()); // This also populates the iconsize for the next line ?>
<?php echo $attachment_link; ?>
How do I edit this so the image appears but is not a link? Thanks in advance.
RIGHT well I now figured out how to get the image to display without being linked, but for the life of me I can’t them to display in their full size!!
You would think,
<?php echo wp_get_attachment_image( $post->ID, ‘full’ ); ?>
would work but for some reason the images max out width wise at 500 pixels! If you put ‘medium’ in it works fine with the images medium and ‘full’ or ‘100%’ works fine for SMALL images but again anything over 500 pixels wide is shrunk to this max.
I am burnt out, please if anyone can step in and help it would immensely appreciated….
I am sorry, I forgot this piece of code.
<?php get_header(); ?>
<?php the_post() ?> <?php $attachment_link = get_the_attachment_link($post->ID, true, array(450, 800)); // YOUR WIDTH HEIGHT ?> <?php $_post = &get_post($post->ID); $classname = ($_post->iconsize <= 150 ? 'small' : '') . 'attachment'; // GIVES SMALL ITEMS A 'SMALL' CLASS ?>
and into your entry-div
<?php echo $attachment_link ?>
- The topic ‘Help Getting Images to Display With Attachment.php’ is closed to new replies.