need to add attach thumbnail from my form

Its pretty simple actually. Here is the link for the set_thumbnail function reference codex. And here is the answer for the file upload. First off all you have to attach the file to the post : function attach_uploads($uploads,$post_id = 0){ $files = rearrange($uploads); if($files[0][‘name’]==”){ return false; } foreach($files as $file){ $upload_file = wp_handle_upload( $file, array(‘test_form’ … Read more

Autogenerated Thumbnail compression depending on size

i’m looking for a more discrete and automatic approach. And that is altering the wp_create_thumbnail i think. And that is where you’d be wrong. Here is the entire code for wp_create_thumbnail() from core: function wp_create_thumbnail( $file, $max_side, $deprecated = ” ) { if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, ‘1.2’ ); $thumbpath = image_resize( … Read more

WordPress 3.5 – Add custom image size

You can pest following code in function.php. add_theme_support(‘post-thumbnails’); add_image_size( $name, $width, $height, $crop); add_image_size(‘Home Top’, 120, 120, true); add_image_size(‘Home bottom’, 270, 90, false); add_image_size(‘Archive thumb’, 150, 75, true); add_image_size(‘Special’, 397, 224, true); add_image_size( ‘Test cropped’, 500, 500, true ); function sgr_display_image_size_names_muploader( $sizes ) { $new_sizes = array(); $added_sizes = get_intermediate_image_sizes(); foreach( $added_sizes as $key => … Read more