How to resize image on client-side before upload?
How to resize image on client-side before upload?
How to resize image on client-side before upload?
Attachments in a gallery are their own posts, with some special settings. To get a list of all the attachments for a given post, you basically just create a new query and specify the post parent and attachment type. $gallery_images = new WP_Query(array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_status’ => ‘inherit’, … Read more
Well all depends und your use case – can the renaming be done in bulk using regex? then go and apply the same regex to the Database, by e.g using http://wp-cli.org/commands/search-replace/ If you need to do it manually maybe take a look at https://wordpress.org/plugins/media-file-renamer/ Good Luck!
the problem is in this line : $attach_id = media_handle_upload( $file_handler, $user_id ); when you use media_handle_upload and provide a second parameter (which in your case you do) the the attachment is associated with a post that has that ID, so basically WordPress thinks your are telling it to save this as an attachment to … Read more
You can make a query to loop through all the attachments, and then update the attachment info for each attachment in the while loop. Something like $args = array( ‘post_type’ => ‘attachments’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ) $query = new WP_Query($args) if($query->have_posts()): while($query->have_posts()): $query->the_post(); // 1. Get the attachment filename here and store … Read more
You can run a script that will programmatically set the featured image for each post. You can use the first attached image for this. To get the attached images run a query for the posts and loop through each one and use get_children() setting the post_parent to the current post id in your loop. $posts … Read more
The thumbnail size is based on the dimensions defined in WordPress Dashboard > Settings > Media, unless your theme overrides it. how can I make my theme override it? To change default post-thumbnail size, you need to use set_post_thumbnail_size. Add this in your functions.php file: if ( function_exists( ‘add_theme_support’ ) ) { add_theme_support( ‘post-thumbnails’ ); … Read more
Create an attachment template file within the theme. Since we are only interested in images, the file should be image.php <?php if ( have_posts() ) { the_post(); $image_url = wp_get_attachment_url(); } header(‘Location: ‘.$image_url); ?> Template Hierarchy
I think you want wordpress setting for media for medium size their are get_option(‘medium_size_w’);//width get_option(‘medium_size_h’);//height all setting store in options table.get more media setting
you can add a filter to the_content hook to strip the images something like: add_filter(‘the_content’, ‘strip_images’,2); function strip_images($content){ return preg_replace(‘/<img[^>]+./’,”,$content); }