add_image_size via An input by user

I have a code here which is to add an image size via user input:

add_action( ‘after_setup_theme’, ‘add_size_for_featuredimage’ );
function add_size_for_featuredimage() {
/*$width_ft = esc_attr(SIO_FTP::$options[‘width_ft_size’]);
$height_ft = esc_attr(SIO_FTP::$options[‘height_ft_size’]);*/
int $width_ft = 378;
int $height_ft = 378;

add_image_size( ‘homepage-thumb’, $width_ft, $height_ft, true ); //
}

If using numbers on width and height, it does work.

ie.) add_image_size( ‘homepage-thumb’, 378, 378, true );

However, when using var on width and height, it doesn’t.

ie.) add_image_size( ‘homepage-thumb’, $width_ft, $height_ft, true );

Can anybody advise on why it has problem with var? Thanks

Read more here:: add_image_size via An input by user

Leave a Reply

Your email address will not be published. Required fields are marked *