• Resolved nobleuk

    (@nobleuk)


    I have been using this for setting Youtube videos post thumbnails, unfortunately what appears to be happening is it is pulling down the file and saving it as “maxresdefault.jpg” (the default filename from Youtube). What happens then is that it overwrites the current file with that name, effectively setting all of my Youtube posts to the same thumbnail image ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hrm, not quite sure what is going on.

    It all should be getting passed through the following function call:

    wds_ms_media_sideload_image_with_new_filename( $video_thumbnail_url, $post_id, sanitize_title( preg_replace( "/[^a-zA-Z0-9\s]/", "-", get_the_title() ) ) )
    

    What this should be doing is passing in the image URL to download from, the current post being saved, and a title to use for the filename.

    When saving the post, do you already have a post title set, or are you leaving that part empty thus far?

    Thread Starter nobleuk

    (@nobleuk)

    Thanks for the response Michael. It’s actually more strange than that. You are definitely right that the post title is being used for the filename being created, however it would appear that the url isn’t being assigned to the post properly.

    I can see the files with proper filenames in my media library so that part is working but this file isn’t being set as the featured image.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Technically, URLs don’t get saved at all. The only meta that saves is an “_is_video” which gets saved as either true or false, and then ideally the attachment ID from the newly uploaded screengrab, as the post thumbnail. This one is done via set_post_thumbnail( $post_id, $attachment_id ); on the save_post action.

    Hard to say why it’s failing at this point, especially since you’re getting the files uploaded.

    Thread Starter nobleuk

    (@nobleuk)

    Some further investigation. It looks like for every thumbnail I’m trying to use, two pictures are being added to my media library. The first one that gets added is perfectly named as you explained previously, but then another one is added with the default filename and the title is the Post ID, and this is the one that is getting assigned to the post.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hoping these issues are addressed in version 1.1.0 which is due soon.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Youtube thumbnails not being renamed’ is closed to new replies.