WordPress.org

Ready to get started?Download WordPress

Forums

Creating additional thumbnail when adding image to post. (6 posts)

  1. andreasmiller
    Member
    Posted 4 years ago #

    When creating a post and uploading an image, I need an additional thumbnail to be created from the uploaded image, in addition to the what is created automatically by WordPress. I am fairly new to WP but have created a custom theme and one plugin, so I have some knowledge. I'm guessing I need to create some sort of hook? to grab the image info when uploading it into a post, but I don't know where to start and haven't worked with hooks before. Any help would be appreciated.

  2. andreasmiller
    Member
    Posted 4 years ago #

    anyone?

  3. mores
    Member
    Posted 4 years ago #

    Why do you need it? Can't you use the intermediate format?
    If you have some theme-programming knowledge, this tool might help you:
    http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/
    It takes an image and resizes it to your desired dimensions at runtime. With cache so it doesn't have to be done all the time.

    I believe there was a similar WordPress plugin, but I can't find it right now.

  4. andreasmiller
    Member
    Posted 4 years ago #

    TimThumb sounds interesting, I'll look into it. The way the page works is that when submitting a picture as a small thumbnail that will show up in the post, we also need a medium version of the same image to be displayed on a separate page. Is there a better way to do this?

    Criteria: upload once through posting tool
    Versions automatically generated: small thumb, medium thumb and the original

    What's the simplest and most size/loading friendly way to do this?

  5. mores
    Member
    Posted 4 years ago #

    it's built in.
    Wordpress creates a thumbnail, creates a medium size, creates a large size (If the original is, for example, 2MP big and you set the "maximum size" to something smaller, the "large" will be the maximum size, and the original will be ... well, the original), and it keeps the original.
    All you need to do is access them with plugins or special functions you use in your theme.

  6. andreasmiller
    Member
    Posted 4 years ago #

    This is what I needed. On the front page in the original post the uploaded pictures are different sizes, but on the single post page I need to display all images in the large size. This worked great to display them, now I just have to format the page in a correct way. Thanks for all your suggestions.

    $images =& get_children( 'post_parent=' . $post->ID . '&post_type=attachment&post_mime_type=image' );
    if ( empty($images) ) {
    	// no attachments here
    } else {
    	foreach ( $images as $image ) {
    		echo wp_get_attachment_image( $image->ID, $size='large' );
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Topic