ThemeShaper Forums » Thematic

[closed]

Separate thumbnail and full image files in WP native gallery

(23 posts)
  • Started 3 years ago by diana
  • Latest reply from Laraine
  • This topic is not resolved
  1. diana
    Member

    I've been working on a gallery and, having looked at many approaches, I'm closest to what I need with the WP's own Gallery: "real" pages generated automatically with next/previous navigation included.

    What I need, that I don't currently have, is the ability to use a separate full image and thumbnail files. The images I'm using have to be cropped by hand for thumbnails.

    After researching gallery plugins and putting a gallery together with template tags and attachment.php, I checked with the WordPress.org forum where a moderator referred me to the image.php. For giggles, I dropped the image.php from the WP Default theme into my child theme and, yes, it threw a syntax error.

    What would you recommend?

    Diana

    Posted 3 years ago #
  2. Hi Diana,

    I'm not sure what you're going for, is it the ability to make a custom sized aspect ratio thumbnail that links to a full sized image or group of images like an album?

    Leslie

    Posted 3 years ago #
  3. diana
    Member

    Ah, no, it's not about the aspect ratio. To be more specific, each image needs to feature a different area in image. For example, one may need to be cropped to the lower right corner while another to the upper left to make the most interesting thumbnail. One full image may show a series of related images all in one, so we'd need to crop to one of those images to keep it large enough to be interesting.

    So, in other words, each image on the site will have it's own cropped thumbnail file before it hits the site and I need a way, within the WP Gallery, to connect the two.

    What do you think?

    Posted 3 years ago #
  4. NextGEN Gallery plugin lets you custom crop a thumbnail.

    Posted 3 years ago #
  5. diana
    Member

    NextGen is a lightbox, right? Do they have the option of giving individual pages for each full image, with their own URLs? I really have to have that.

    Posted 3 years ago #
  6. Sounds like you want each photo to be a single post in a category, with a custom thumbnail?

    Posted 3 years ago #
  7. diana
    Member

    Well, what I've been working on using using the WP Gallery within a page to create the group of thumbnails each of which opening to an attachment.php based page. I haven't played with categories and the single.php. Would it be easier to accomplish that way?

    Well, heck, I've already passed easy. I know it's a tall order. Would I be able to use the Gallery in combination with single.php, getting the custom thumbnail to link to full image while keeping the easy of set up and editing of the Gallery? The only options in Gallery I see are link to Image File or Attachment Page.

    Posted 3 years ago #
  8. Maybe there's a way to customize the attachment.php file to navigate to the next image in a gallery? But that's beyond my skills...

    Posted 3 years ago #
  9. diana
    Member

    Yes, the next_image_link and previous_image_link template tags can be used for navigation between images in gallery quit nicely. Thanks for getting in and offering ideas.

    Posted 3 years ago #
  10. Glad it worked! You don't happen to know anything about jQuery would you? :)

    Posted 3 years ago #
  11. diana
    Member

    Well, the connection between thumbnail and full image hasn't worked yet. Working on it.

    Jquery, not so much. http://jqueryfordesigners.com/ looks good.

    Posted 3 years ago #
  12. thanks for the link.

    Nextgen might still work for you, you can turn off the java script option and make a custom link:

    http://www.kimwoodbridge.com/how-to-link-nextgen-gallery-images-to-an-individual-page-or-post-in-wordpress/

    Posted 3 years ago #
  13. Ok, I'm late to the discussion. Do you want an attchment.php or image.php template that allows for navigation between images in a vanilla WP gallery?

    Something like this might work for you.

    function my_attachment_nav($postfooter) {
    	if( is_attachment() ) {
    		$image_nav = "\n\t\t\t\t" . '<div class="navigation">';
    		$image_nav .= "\n\t\t\t\t\t" . '<div class="alignleft">' . previous_image_link() . '</div>';
    		$image_nav .= "\n\t\t\t\t" . '<div class="alignright">' . next_image_link() . '</div>';
    		$image_nav .= "\n\t\t\t</div>\n";
    		$new_postfooter = $image_nav . $postfooter;
    	}
    	return $new_postfooter;
    }
    add_filter( 'thematic_postfooter', 'my_attachment_nav' );

    -Gene

    Posted 3 years ago #
  14. diana
    Member

    Thanks, em hr, for jumping in. I already had the nav between images, though I like how you fleshed it out as a function.

    What is still sticking in my craw is linking a separate hand-cropped thumbnail file to a separate full image file. I'm using the native WP Gallery. As you may know, WP Gallery automatically crops a single image file to thumbnail size and opens each thumbnail with attachment.php to show the full size image. I'm looking for a way to use a separate pre-cropped image for the thumbnail and use another file, the full image, in the attachment.php.

    Any ideas? Do I need to drop the WP Gallery and go in another direction?

    Posted 3 years ago #
  15. what do all those n\t\ 's do I wonder? (As a non-programmer I like to exercise my right to ask stupid questions!)

    Diana as a last resort you could rename your custom thumbnails and upload them via ftp to overwrite the ones generated by wp but that seems silly.

    Posted 3 years ago #
  16. Those are Control Characters \n gives a newline and \t gives a horizontal tab. The only purpose in including them is to make the source code more readable.

    Posted 3 years ago #
  17. diana
    Member

    Thanks, lastraw. Though it's sort of inelegant, overwriting thumbnail images via FTP does work.

    Posted 3 years ago #
  18. thanks Gene for the \n\t clarification.

    Posted 3 years ago #
  19. em hr, your code doesn't work.
    The problem is that the images thumbnail go BEFORE the navigation div...
    It should be something like get_previous_image_link() but I don't think this template tag exist.

    The problem is the combination of previous_image_link() and the PHP code used, I think, but I'm not that good in PHP coding. So, how could we say "just output previous_image_link the way it is"?

    Posted 3 years ago #
  20. Another problem of this code is that the "normal" footer disappear, maybe cause it's added at the end of the footerpost?

    Posted 3 years ago #
  21. Ack! Sorry, Thats what i get for being in a hurry and not paying attention to the code. You'd think I'd have learned by now that we can't use functions that echo inside of a filter function. Functions that only echo are better suited to be included with action hooks.

    I think for now the best soultion for adding these functions is making an image.php template for your child theme and adding the previous_image_link() and next_image_link() where you like.

    Another problem of this code is that the "normal" footer disappear

    and I need to remember that if we filter something conditionally we must return the original value if the condition is not met.

    function child_attachment_postfooter($postfooter) {
        if( is_attachment() ) {
            $new_postfooter = "Add something before the postfooter" . $postfooter;
            return $new_postfooter;
    	   } else {
            return $postfooter;
    	   }
    }
    add_filter( 'thematic_postfooter', 'child_attachment_postfooter' );

    -Gene

    Posted 3 years ago #
  22. Now it works (quite) fine. Simplier seems to create an image.php, that's right.
    But that's a problem of every theme, it seems: noone seems to be interested in galleries :D

    Posted 3 years ago #
  23. Laraine
    Member

    This thread comes closest to my question. Next/previous navigation on WP's own Gallery pages is missing from my image gallery attachments. Thanks for advice on solving this.

    http://www.larainearmenti.com/portfolio/01_scone/

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.