-
AuthorPosts
-
January 6, 2021 at 5:20 pm #1270671
Hello,
I would like the images I import to the site to stay in their original ratio. However, currently they are automatically recized and cropped. For example, when I import images to the blog, they are cropped to format 495x400px, and therefore they appear blurry.. :(Could you help please ?
I’ll appreciate itThank you,
AudreyJanuary 7, 2021 at 4:45 am #1270759Hi Audrey,
Try adding this code in your child theme’s functions.php file:
add_filter( 'avf_modify_thumb_size', 'enfold_customization_modify_thumb_size', 10, 1 ); function enfold_customization_modify_thumb_size( $size ) { $size['portfolio'] = array('width'=>990, 'height'=>800', 'crop' => false); return $size; }
Then try to re-upload the image/s if there are lots of them then use Regenerate Thumbnails plugin.
Best regards,
NikkoJanuary 7, 2021 at 10:02 am #1270810Hi,
Your code causes a critical error on the site. Could you check it ?
Thanks,Audrey
January 7, 2021 at 5:02 pm #1270905Hi Audrey,
I apologize for that, the error was caused by the extra ‘ after 800, this is the fixed code:
add_filter( 'avf_modify_thumb_size', 'enfold_customization_modify_thumb_size', 10, 1 ); function enfold_customization_modify_thumb_size( $size ) { $size['portfolio'] = array('width' => 990, 'height' => 800, 'crop' => false); return $size; }
Best regards,
NikkoJanuary 7, 2021 at 6:30 pm #1270935Hi Nikko,
It’s the same.. the code causes a critical error :(Thank’s in advance
AudreyJanuary 8, 2021 at 1:28 am #1270973Hi Audrey,
I have tested the code and it does not cause any errors on my end.
Can you give us FTP access? we’ll try to add it for you.Best regards,
NikkoJanuary 8, 2021 at 10:09 am #1271018Hi Nikko,
Please excuse me, I tried again and the code does work ! Is it possible to prevent cropping of the image inside the article? This one is cropped at 800x321px. I would like to leave the original size of the photo 800×600.
Thank you very much for your help
AudreyJanuary 8, 2021 at 6:45 pm #1271136Hi Audrey,
We’re glad that it worked :)
Please replace the last code I gave with this one:add_filter( 'avf_modify_thumb_size', 'enfold_customization_modify_thumb_size', 10, 1 ); function enfold_customization_modify_thumb_size( $size ) { $size['portfolio'] = array('width' => 990, 'height' => 800, 'crop' => false); $size['entry_with_sidebar'] = array('width' => 800, 'height' => 600, 'crop' => false); return $size; }
Then re-upload the images or regenerate them.
Best regards,
NikkoJanuary 8, 2021 at 7:23 pm #1271151Thank you very much Nikko ! It’s perfect
Have a good dayBest regards
AudreyJanuary 10, 2021 at 6:51 am #1271307Hi Audrey,
Great, I’m glad that Nikko could help you out. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardJanuary 10, 2021 at 3:30 pm #1271364Hi Rikard,
Yes you can close it, thank you very muchHave a good day
Best regards,
AudreyJanuary 11, 2021 at 2:01 am #1271410Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘How to prevent images from being resized’ is closed to new replies.