What do you mean specific size? Can you give more information.
When I upload a logo for Header logo using OptionTree framework it uploaded original size But I wanted a client can upload any size of logo but it will crop a certain size. I wanted to add any option for crop image by using OptionTree.
Have you considered saving the logo as an attachment ID instead of a url? Then you could add an image size to your theme and force WP to crop it for you.
Actually, I used below code –
<?php
$header_logo = ot_get_option(‘headerlogo’);
?>
and
<?php if($header_logo): ?>
“><span><img src=”<?php echo $header_logo; ?>” alt=””></span>
<?php endif; ?>
—-
I could not understand how do I add attachment ID? Could you please help me?
This is pulled from the Option Tree theme and demonstrates how to save the upload option type as an attachment ID. Which is by adding a class of ot-upload-attachment-id to the array.
array(
'id' => 'demo_upload_attachment_id',
'label' => __( 'Upload Attachment ID', 'option-tree-theme' ),
'desc' => sprintf( __( 'The Upload option type can also be saved as an attachment ID by adding %s to the class attribute.', 'option-tree-theme' ), '<code>ot-upload-attachment-id</code>' ),
'std' => '',
'type' => 'upload',
'section' => 'option_types',
'rows' => '',
'post_type' => '',
'taxonomy' => '',
'min_max_step'=> '',
'class' => 'ot-upload-attachment-id',
'condition' => '',
'operator' => 'and'
)