• Resolved Andrew Tegenkamp

    (@andrewteg)


    I added a file called dummy.pdf to the Media Library and it created an image at a path like /wp-content/uploads/2023/11/dummy-pdf-212×300.jpg and that shows on the attachment page, like /dummy.

    I can also “Edit More Details” to view the info and update the caption and description at /wp-admin/post.php?post=86&action=edit, too.

    What I cannot figure out is how to change that image, as the auto-generated image is often not what I want, and some file types do not create images and I need them for a theme I am building out.

    How can I change the image of a Media Library item?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • luisherranz

    (@luisherranz)

    Usually, if you want to replace an image, it’s easier to delete the old one and re-upload the modified image again.

    But if what you want is to replace the old image with a new version for some reason, you can also install a plugin that adds that functionality to WordPress: Search Replace Image plugins.

    Let me know if that helps.

    Thread Starter Andrew Tegenkamp

    (@andrewteg)

    It seems those plugins replace the image in the Media Library, but I’m looking to replace the image generated by the Media Library for non images.

    Put another way, I basically want to create a featured image for a Media Library Document. I don’t see where those plugins do that.

    luisherranz

    (@luisherranz)

    Ohh, gotcha. I don’t think that’s possible. One thing you could do is add the image you want to the description and remove the featured image from the attachments template. That way, users won’t see the auto-generated image, and they’ll see the one you want.

    Thread Starter Andrew Tegenkamp

    (@andrewteg)

    After realizing I just needed the Featured Image, I tried to add it to the Media Library as you would for a Custom Post Type, and that works!

    add_action( 'after_setup_theme', 'my_child_theme_setup', 100 );
    function my_child_theme_setup() {
    	add_post_type_support( 'attachment', 'thumbnail' ); //attachment is post_type for built in Media Library
    }
    

    This creates a Featured Image box when editing Attachment Details and creates a _thumbnail_id entry in the wp_postmeta the same as a post!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit Image for Media Library Document?’ is closed to new replies.