WordPress.org

Ready to get started?Download WordPress

Forums

stop shrinking custom header images (7 posts)

  1. Alexander Hoereth
    Member
    Posted 3 years ago #

    Hey there,
    I want to have the uploaded custom header images to have a width of max 940px and a heigt of max 400px.
    If the uploaded image is smaller it should not be resized or cropped in the upload process - only if it is bigger than 940*400.

    Is there a way to do that?

    At the moment smaller images get scaled up and cropped to the size defined in the functions.php (HEADER_IMAGE_WIDTH and HEADER_IMAGE_HEIGHT)..

  2. zeaks
    Member
    Posted 3 years ago #

    You could put the image you want on a colored background which is the proper size so it doesn't get resized on upload.

  3. Alexander Hoereth
    Member
    Posted 3 years ago #

    not very comfortable fot the end user, is it? if it would be the theme im going to use i would do smth like that - but what about themes for others? i do not want to tell the client that he has to edit his headers manually

  4. zeaks
    Member
    Posted 3 years ago #

    Well you could add your own code to the theme for this function. Not every theme was made to be perfect for every user in every situation. I find twenty ten to be very flexible and easy to edit.

    I suppose the reasoning behind it is if the image were smaller it would require the theme to auto adjust to the size of the header being used. I'm no coder but I would guess that is a fairly extensive bit of code, the same thing goes for the reason why the header is cropped to a certain size.

    If you are using twenty ten, one way to get around this might be to try a theme called twenty ten weaver, which is alot like twenty ten but with more options. It has an option to choose what size you want the header to be, as well as many others. There is also 3 different flavors, one for beginners, one for advanced and one for theme creators.

    http://wpweaver.info/

  5. Alexander Hoereth
    Member
    Posted 3 years ago #

    well i am not directly using twenty ten; i am using a wordpress integraded feature..

    maybe i start coding a plugin which changes this functionality - have no idea how to do this yet. completly new into plugins. but i think other designers would like this possibility as well.. maybe wordpress 3.1 will include it?
    anyone got an idea of how to start off to overrite a wordpress function without editing the core files and without an extra user interface?

  6. Alexander Hoereth
    Member
    Posted 3 years ago #

    Ok.. well.
    I found the the main functions i would have to edit in the wp core - but is there a way to edit or overwrite them via a plugin?

    - step_2() located in line 564 in wp-admin/custom-header.php and handles the upload
    - step_3() located in line 649 and handles the cropping

  7. Alexander Hoereth
    Member
    Posted 3 years ago #

    Ok. I justed hacked the core file. Where do I have to go to submit code to wordpress? I think it would be nice to have this in future WordPress Versions.

    Edit: just started a ticket at http://core.trac.wordpress.org/ - nfm

Topic Closed

This topic has been closed to new replies.

About this Topic