1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Please provide an image whose longer side is no more than twice the length of its shorter side.

Discussion in 'Styling and Customization Questions' started by time, Jul 12, 2013.

  1. time

    time Active Member

    When a member of my make up avatar images, some images display the message "Please provide an image whose longer side is no more than twice the length of its shorter side.". So, how do I fix this problem
     
  2. tenants

    tenants Well-Known Member

    No way that I know of in the ACP, it's a core restriction. Ask your member to use an image that is approximately square (or at least closer to square than rectangle)

    This is a restriction when uploading images to prevent the different scaled images looking strange
    Code:
            // require 2:1 aspect ratio or squarer
            if ($width > 2 * $height || $height > 2 * $width)
            {
                throw new XenForo_Exception(new XenForo_Phrase('please_provide_an_image_whose_longer_side_is_no_more_than_twice_length'), true);
            }
    

    If you look at XenForo_Model_Avatar, when creating the images for large, medium, small, the following dimensions are used:

    Code:
        protected static $_sizes = array(
            'l' => 192,
            'm' => 96,
            's' => 48
        );
    
    The image is then scaled down to the following
    48x48 (small),
    96x96 (medium),
    192 * scaled width (large)

    Although... there is some cropping allowed, if you imagine scaling down a very wide image:

    stretch.png

    into a 96x96 square, it might look strange (although, I'm not completely sure why we can't use the cropping for all size images and allow very wide images to be cropped)

    Maybe ask for this as an enhancement?
     
    Last edited: Jul 12, 2013
    time likes this.
  3. time

    time Active Member

    @tenants,
    That is exactly the answer for me. thank you
     

Share This Page