• Resolved alargule

    (@alargule)


    Just installed the Prototype 0.1 theme. Nice and simple theme, so I’m keen on keeping it for my website.
    However, if I upload images with dimensions above a certain size and I want to display them on my site, these images are being resized.

    Is there any way around this (apart from activating another theme…), so that I can show images in their original size?

    Thanks all!

Viewing 13 replies - 1 through 13 (of 13 total)
  • when you insert the image, make sure to select “full size” as the image size…this should insert the image at the original dimensions.

    Thread Starter alargule

    (@alargule)

    Thank you, but that does not seem to be the problem.

    When I use Twenty Ten as the theme for my website, the images are still shown resized. However, Twenty Ten offers an option to display the full size image, whereas Prototype 0.1 does not seem to support that feature.

    can you provide a link where we can see this?

    Thread Starter alargule

    (@alargule)

    ok well this makes sense. i am not sure why you would want to display an image that is 1300 pixels wide on a theme that is only 900 pixels wide?

    NOTE: if the user goes to save the image, they will get the original resolution of the image.

    Thread Starter alargule

    (@alargule)

    OK, I’m sorry.

    Maybe I should rephrase my question:

    is there any way that I can modify this theme in such a way, that the resized images offers a link to the image with the original dimensions? Say a link at the top of the image, or the possibility to click on the image to display the original?

    Possibly involves some re-coding of the templates, but I’m not that good at php to be honest.

    oh yes this is doable. create (or modify) attachment.php in your theme. if you need help doing this let me know.

    Thread Starter alargule

    (@alargule)

    Sorry for my late response; any help would be greatly appreciated, though!

    I’ve been comparing the attachment.php files for the Twenty Ten theme and the Prototype 0.1 theme. As far as I can see, the hyperlink to the full-sized image is being controlled by this code segment in Twenty Ten:

    if ( wp_attachment_is_image() ) {
    								echo ' <span class="meta-sep">|</span> ';
    								$metadata = wp_get_attachment_metadata();
    								printf( __( 'Full size is %s pixels', 'twentyten'),
    									sprintf( '<a href="%1$s" title="%2$s">%3$s &times; %4$s</a>',
    										wp_get_attachment_url(),
    										esc_attr( __('Link to full-size image', 'twentyten') ),
    										$metadata['width'],
    										$metadata['height']
    									)
    								);
    							}

    …whereas the Prototype theme has this:

    if ( wp_attachment_is_image( get_the_ID() ) )

    A simple copy-and-paste action from the Twenty Ten file to the Prototype file did not do the trick, of course. So some things should be changed, but I don’t know which?

    can you please identify and post the code controlling the insertion of the image in your Prototype 0.1 theme?

    and fyi, the if statement should work just fine. but let’s take a look at the code and see if we can figure it out.

    Thread Starter alargule

    (@alargule)

    This should be it:

    <?php if ( wp_attachment_is_image( get_the_ID() ) ): ?>
    
    								<p class="attachment-image">
    									<?php echo wp_get_attachment_image( get_the_ID(), 'full', false, array( 'class' => 'aligncenter' ) ); ?>

    ok just like i thought, there’s nothing linking the image to it’s full size.

    replace this line

    <?php echo wp_get_attachment_image( get_the_ID(), 'full', false, array( 'class' => 'aligncenter' ) ); ?>

    with

    <?php
    $full = wp_get_attachment_image_src(get_the_ID(),'full');
    echo '<a href="' . $full[0] . '" target="_blank">' . wp_get_attachment_image( get_the_ID(), 'full', false, array( 'class' => 'aligncenter' ) ) . '</a>';
    ?>

    that should work just fine 😉

    Thread Starter alargule

    (@alargule)

    ucfknight10: that works great! Never would have thought it would be that easy 🙂

    Thank you for your help!

    not a problem @alargule. *mark as resolved*

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Prototype 0.1: displaying images full size’ is closed to new replies.