• I have searched before asking. I found a few plugins and forumposts, but they aren’t working for 2.7 yet. I hope there might be a quick hack or maybe I missed a plugin or post.

    I would like to have 75×75 and 225×225 thumbnails (If it’s possible, I could also use 150×150 but I can use the 225×225 thumb for it.)

    I tried changing line 147 in wp-includes/media.php
    function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=false) {
    to
    function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=true) {
    but I don’t think it’ working.

    I hope someone can help me on the right direction. Thank you ??

    Yannick

Viewing 5 replies - 1 through 5 (of 5 total)
  • you don’t need to hack the code, you just have to change the medium size crop option from 0 to 1, which you can do from your functions.php file, or by writing a plugin.

    placing something like this inside your functions.php should do the trick:

    if(!get_option("medium_size_crop")
        add_option("medium_size_crop", "1");
    else
        update_option("medium_size_crop", "1");

    also take a look at this topic if you wish to add more image sizes to your wp installation.

    sorry, pasted the wrong option again, argh, should be:

    if(!get_option("medium_crop")
        add_option("medium_crop", "1");
    else
        update_option("medium_crop", "1");

    aesque … when I paste this code into a functions.php, I get an error … could you tell me how to implement this properly?

    EDIT: there’s a bracket missing in the first line. Should be

    if(!get_option("medium_crop"))
        add_option("medium_crop", "1");
    else
        update_option("medium_crop", "1");

    Now if only I could find a way to do this only for landscape format images, and leave the portraits the way they are ….

    oops sorry about that ??

    also, i’ve learned recently, it’s better to check an option’s existence with

    if(false === get_option())

    than with

    if(!get_option("medium_crop"))

    because the second version will also return false (equal to true, that is) if option is there, but empty.

    mores: i’ll look into it, it all depends on the order in which functions are executed.

    Thanks, for looking into the portrait/landscape thing and the info on the option-checking!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Force crop to Medium size’ is closed to new replies.