Width 100%: Aspect ratio of image
A + C: img.resize-proportionally { max-width: 100%; height: auto; } As an aside, for the above to work, you shouldn’t attempt B. Having width and height attributes in the img tag is good.
A + C: img.resize-proportionally { max-width: 100%; height: auto; } As an aside, for the above to work, you shouldn’t attempt B. Having width and height attributes in the img tag is good.
Like it was said, WordPress only generate thumbnails in the new sizes of the new media uploaded. The old images’ thumbs doesn’t get generated automatically. For this situation, I strongly recommend the following plugin: http://wordpress.org/plugins/force-regenerate-thumbnails/ It is pretty simple and unobtrusive. It just adds a new item on the wp-admin menu for you to regenerate … Read more
Since you know the location of the image on the disk you can use wp_insert_attachment to insert your big image to the media library. By default this will generate also several smaller versions of the big image that you might not need but this is the easiest way to make all the media related plugins … Read more
u can use this: function wpse128538_resize($url, $width, $height = null, $crop = null, $single = true) { //validate inputs if (!$url OR !$width) return false; //define upload path & dir $upload_info = wp_upload_dir(); $upload_dir = $upload_info[‘basedir’]; $upload_url = $upload_info[‘baseurl’]; //check if $img_url is local if (strpos($url, $upload_url) === false) return false; //define path of image … Read more
If you need to retain only images for last 50 posts, I don’t think that a cron job or a WP cron is the best thing you can do, in WordPress you can know when a post is published, and you can run a routine everytime it happen, deleting images for the post pubblished 50 … Read more
I know its too late for this answer, but can help others, you can use Media Deduper plugin to index and find duplicated image , it is also good enough to link the post to existing image.
Contrary to Pieter, I’d say your if statement is correct (although, unnecessary). If it’s a WordPress theme, then add_theme_support will likely exist! Have you per chance added the images before setting the post thumbnail size? If so, you need to regenerate your images: http://wordpress.org/plugins/regenerate-thumbnails/
I would rather just set the width and let the height be automatically adjusted to the proportion, so I won’t even have to crop the images. If the images are not all the same proportion then some cropping will have to be done. If you want to avoid cropping then you’ll need to make sure … Read more
First, please don’t use query_posts() (emphasis mine)! Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the … Read more
The only way to do it is using a query filter I think function wpse156319_posts_where( $where, $query ) { global $wpdb; $where .= $wpdb->prepare( ‘ AND (‘ . $wpdb->posts . ‘.post_parent = %s OR ‘ . $wpdb->posts . ‘.post_author = %s)’, $_POST[‘id’], get_current_user_id() ); return $where; } which you just add in the ajax_query_attachments_args instead … Read more