Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #302273

    Hey,

    I noticed more people are looking to resize the testimonial images. It seems the recommended methods require functions.php edits and such, which means the edits have to be re-done after each theme update. Which is a bit of a hassle.

    Also, changing the thumbnail size setting via Settings > Media is possible. But since Enfold uses 80px*80px by default, this could lead to issues with other images using this setting.

    So, here’s a tip that doesn’t require changes to core code / core settings:

    Follow these steps if you want your testimonial images to be, for example, 150px*150px in size (instead of the default 80*80)… please note: these steps assume the required custom CSS is already set to 150px*150px:

    • Simply set the testimonial images via the Avia Layout Builder;
    • You’ll notice the images are 80px*80px scaled to 150px*150px, because of your custom CSS, which might look a bit ugly;
    • To force the theme to use actual (unscaled) 150px*150px images, just rename the real 150px*150px images on your computer to: IMAGE_NAME-80×80.jpg;
    • Upload the renamed images to your server and make sure they overwrite the orginal 80×80 images;

    You basically overwrite the 80*80 thumbnails on your server, which are used by Enfold, with images that have the size you require / the custom CSS dictates. So even though the images are named 80*80, their actual size can be anything you require. Enfold will then use these images without scaling them.

    I hope the above makes sense :)

    Good luck,

    Ralph

    #302328

    Hey Ralph12!

    Thanks for sharing. You can also use a filter to change the thumbnail size of the testimonial image. Use this on functions.php:

    add_filter('avf_testimonials_avatar_size', 'avf_adjust_testimonials_avatar_size' );
    
    function avf_adjust_testimonials_avatar_size($avatar_size) {
    	$avatar_size  = 'square';
    	return $avatar_size;
    }

    Upload the images again if you already have the testimonial section or regenerate the thumbnails using this plugin: http://wordpress.org/plugins/regenerate-thumbnails/

    Best regards,
    Ismael

    #302454

    Hey Ismael,

    You’re welcome! Thanks for the filter code!

    Your filter is for Enfold’s own functions.php file, right? Also, if I’m correct, the functions.php file is overwritten after each theme update, right? If yes, then one has to restore the custom PHP code / functions.php file, after each theme update?

    The reason I came up with the above non-PHP solution, is that I was looking for a solution that isn’t affected by theme updates. In my experience, having to restore custom code after every WP / theme update, makes every update a bit of a hassle. Especially when you’re running multiple WP-based websites, each with its own set of customizations. In fact, I started to dislike WP’s ‘New Updates’ notifications, because I knew it meant quite some unexpected extra work… having to restore my custom code. But if your filter sticks, even after an update, then that’s obviously a nicer solution :)

    Also, for some types of image uploads, Enfold lets the user select the size of the image during image selection (e.g. full size). How about enabling this setting also for testimonial image selection? I guess that would be the easiest method of all :)

    Kind regards,

    Ralph

    #302819

    Hey!

    If you use a child theme then no, the file would be left intact on each update. There are also a few plugins that go around the functions file and allow you to add your own just like what a child theme does.

    Either way thank you for posting the solution that worked for you :)

    Regards,
    Devin

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Tip: resizing (testimonial) images without PHP edits’ is closed to new replies.