How to delete outdated, wrongly sized images in _wp_attachment_metadata?
Not from personal experience (I don’t use WP image management much), but I believe Regenerate Thumbnails plugin is usually recommended for rebuilding thumbnails.
Not from personal experience (I don’t use WP image management much), but I believe Regenerate Thumbnails plugin is usually recommended for rebuilding thumbnails.
We can do that! First, you’ll need to add a custom section on the Theme Customizer, containing all the image uploads (we’ll use 3 for this example): add_action( ‘customize_register’, ‘themename_customize_register’ ); function themename_customize_register($wp_customize) { $wp_customize->add_section( ‘slides’, array( ‘title’ => ‘Slides’, ‘priority’ => 25, ) ); $wp_customize->add_setting( ‘first_slide’, array( ‘default’ => ”, ) ); $wp_customize->add_control( new … Read more
Just as @s_ha_dum suggests, you can loop through all of your posts and update the content of each one. The following gives you the idea but is untested: $posts = get_posts( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 500, ‘offset’ => 0, ) ); foreach( $posts as $post ): // Update each post with your reg-ex … Read more
I suggest you to use the more newer media manager dialog; WordPress will hanlde all the image upload stuff, including generating intermediate sizes and attachement metadata. Here a working example (it is a quick example built from a previous code, it may needs some tweaks to be used on production): add_action( ‘admin_enqueue_scripts’, ‘load_wp_media_files’ ); function … Read more
There is too little information to be completely sure, but usually this error occurs when WordPress cannot find the graphic library which should be installed on your server. So you should check with your provider to see if Imagick and/or GD are installed. You can also add this little snippet of code in your functions.php … Read more
Sure. You could hook the save_post action, use WP_Http class to download it and then insert it as an attachment using wp_insert_attachment and wp_update_attachment_metadata(). It’s not trivial but shouldn’t be that hard.
That’s because php code inside a CSS file is not parsed unless you configure your server to. Just use it as a relative path to the image (as per the CSS file). background: url(“images/bg.jpg”);
Tony, are you creating a new post or editing an older post from 2010/07? I’ve found that the folder relates to when the post/page was created initially.
Let’s assume that your theme is NOT rolling its own gallery shortcode, and let’s assume that you’re using the shortcode rather than the ‘gallery’ post format here. What you’re looking for is the ‘gallery_shortcode’ function within wp-includes/media.php around line 750 (as of 3.3.1). That’s where the HTML output of your gallery items is hard-coded. Of … Read more
In general I wouldn’t recommend modifying the original uploaded image files, just in case we might need to re-generate intermediate sizes. But let’s see if it’s possible 🙂 We can in general let WordPress choose the image editor, that depends on modules like GD or Imagick, through: $editor = wp_get_image_editor( $file ); but this can … Read more