Delete images of a particular size

Yap, a similar things happened to us once. And one of our senior developer and my teacher, Ms. Tahmina Akter, made the following code for us. Though it’s too rough, and there are some deprecated PHP functions too (I fixed them and updated the code), but it works. CAUTION: Handle it with PROPER CARE, because … Read more

problem with updating metabox of upload image

I have no time to write at your code, but with your help works for me function wms_add_headerimage_cb( $post ){ //campuri $values = get_post_custom( $post->ID ); $headerpageimage = isset( $values[‘headerpageimage’][0] ) ? esc_attr( $values[‘headerpageimage’][0] ) : ”; $img_src = wp_get_attachment_image_src( $headerpageimage, ‘medium’ ); wp_nonce_field( ‘allpages_meta_box’, ‘allpages_meta_box_nonce’ ); ?> <p> <img id=”headerpage_image” src=”https://wordpress.stackexchange.com/questions/182634/<?php echo $img_src[0] ?>” … Read more

Get first URL from custom field, download and set as featured image on post publish

You can access custom fields like that: get_post_meta($post_id, $key, $single); see https://codex.wordpress.org/Custom_Fields you could extent some of the plugins that already solve the rest of your problem like the wp-autoset-featured-image-plus plugin and tell it to use the string from your custom field instead of the post body. the relevant code part should be this line … Read more

How to show images uncropped after uploading?

The theme you are using crops uploaded pictures, but there is always a version of the picture which keeps the original full size. Modify the code that render the picture that it will use the size parameter. Eg: Use: wp_get_attachment_image: echo wp_get_attachment_image( $attachment->ID, ‘full’ ); Or: display post_thumbnail: echo get_the_post_thumbnail( $post->ID, ‘full’ ); ‘full’ here … Read more