- This topic has 19 replies, 5 voices, and was last updated 4 years, 11 months ago by Tom.
-
AuthorPosts
-
August 7, 2017 at 3:53 am #360904Roger
Hi,
This is my first post on here, I’m using GP and Elementor Pro. I’m fairly new to both.
I’m creating a new Artist Portfolio site and would like to have some custom image sizes to use when setting up galleries in Elementor – I’m an artist/designer so not a coder so is there an easy way to do this please?
cheers!
August 7, 2017 at 8:38 am #361049LeoStaffCustomer SupportHi there,
Not quite sure what you are after?
If this is to be done with Elementor then it might be better to ask their support.
Let us know ๐
August 7, 2017 at 9:54 am #361113Rogerhi Leo, sorry, i mean in the WordPress media library/uploader you have a dropdown menu with a selection of sizes for images and this is the same in Elementor so I’dd like to be able to set my own custom sizes…
cheers
August 7, 2017 at 10:51 am #361140LeoStaffCustomer SupportYou should be able to use Scale Image in Edit Media through WordPress: https://codex.wordpress.org/Edit_Media#Edit_Image
August 7, 2017 at 11:24 am #361160RogerThanks, but thats not what i mean – I’ve seen some themes like customizr i built my first site with has a whole list of custom sizes you can choose to use for that image when you add it to a site in WP but in GP I only have the default sizes that WP uses to resize. The main issue is in elementor I want to have a square image format to control sizes in the Image Gallery Element – as the only options are
Thumbnail
Medium
Medium Large
Large
Fullthanks
August 7, 2017 at 11:38 am #361170TomLead DeveloperLead DeveloperYou can use the
add_image_size()
function for that: https://generatepress.com/forums/topic/custom-crop-for-blog-index-featured-images/#post-357876August 7, 2017 at 11:48 am #361174RogerThankyou,Tom, ill take a look!
August 7, 2017 at 11:48 am #361175TomLead DeveloperLead DeveloperNo problem ๐
August 7, 2017 at 12:57 pm #361226DavidStaffCustomer SupportTheres probably a lot of people using Elementor that will find that Action very useful. It surprised me that there wasn’t an option in Elementor…..
March 19, 2019 at 4:09 pm #843904ShawnI just came across this string about custom image sizes. I’m also using the GP theme with Elementor. I need to create additional sizes beyond medium and large but I’m not clear about the add image size function. Based on Tom’s link above, does the size information go into the functions section of the parent or child theme?
Thanks.
March 19, 2019 at 5:23 pm #843944TomLead DeveloperLead DeveloperIt would go into the child theme ๐
March 20, 2019 at 5:04 am #844313ShawnOk, thanks.
March 21, 2019 at 4:18 pm #846121ShawnTom,
This worked great:
add_action(‘after_setup_theme’, ‘tu_add_image_sizes’);
function tu_add_image_sizes() {
add_image_size( ‘horiz-med’, 800, 526, true ); // (cropped)
}When I went back and added another image size by doing this:
add_action(‘after_setup_theme’, ‘tu_add_image_sizes’);
function tu_add_image_sizes() {
add_image_size( ‘horiz-med’, 800, 526, true ); // (cropped)
add_image_size( โvert-med’, 800, 1050, true ); // (cropped)
}I then received this error message: syntax error, unexpected ”, 800, 1050, true ); // (crop’ (T_ENCAPSED_AND_WHITESPACE)
What did I do wrong?
March 21, 2019 at 4:45 pm #846138TomLead DeveloperLead DeveloperHmm, I’m not seeing anything wrong.
Try this:
add_action( 'after_setup_theme', function() { add_image_size( 'horiz-med', 800, 526, true ); add_image_size( 'vert-med', 800, 1050, true ); } );
March 22, 2019 at 10:55 am #846823ShawnI didn’t get an error message adding this code to the php functions.
Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.