WordPress.org

Ready to get started?Download WordPress

Forums

Resize image via percentage of original size (3 posts)

  1. kayelless
    Member
    Posted 5 years ago #

    I've been trying to modify the image resize code to create thumbnails from the original image by just shrinking the original by a percentage. I can easily do this with CSS class on a custom field; however I'm using the Timthumb automatic thumbnail generator. I can't figure out how to either disable it or change the following code to reflect a percentage

    $values = get_post_custom_values("fpthumb"); echo $values[0]; ?>&w=300&h=275&zc=1&q=100"

    Anyone know how to do this? Thank you.

  2. kayelless
    Member
    Posted 5 years ago #

    After trial and error research I discovered to change the above code to ?>&w=''&h=''&zc=0&q=100"
    The w & h parameters are left blank to prevent pixel size restraints
    zc = zoom or crop so set this to "0" which means to "zoom" the full image for resizing without cropping.

    Then I further added a CSS image class which provided the size parameters in percentages as below:

    $values = get_post_custom_values("fpthumb"); echo $values[0]; ?>&w=''&h=''&zc=0&q=100"
    alt="<?php the_title(); ?>" class="thumbnail"
    CSS
    thumbnail {
    float: left;
    height: auto;
    width: 25%;
    margin-top: auto;
    margin-right: 2%;
    margin-bottom: auto;
    margin-left: auto;
    }

  3. martyn334
    Member
    Posted 5 years ago #

    i been after something like this for some time, can you explain in abit more detail please mate?

Topic Closed

This topic has been closed to new replies.

About this Topic