Jump to content

Youtube And Vimeo Thumbnail Grabber


adrian

Recommended Posts

Resolved the site not working so back to this thread.

You were quite right; the module had been installed in:

GetVideoThumbs-master

I did the upgrade via the link in the modules entry which caused the intial error (which in future i'll make note of!)

When I looked back at the modules directory I noticed there was an additional module named :

ProcessGetVideoThumbs

which i'm assuming caused the problem.

Since deleting this new module directory the site is back working again. What's the easiest way to upgrade the module without breaking the site?

Link to comment
Share on other sites

Here is the information the module shows:

Title 	Get Video Thumbnails
Class 	ProcessGetVideoThumbs
File 	/site/modules/GetVideoThumbs-master/ProcessGetVideoThumbs.module
ID 	156
Version 	0.2.3 - check for updates
Summary 	Automatically populates an images field with thumbnails (poster imagses) from YouTube and Vimeo

The site is now working since deleting the new module directory.

What is the safest way to uninstall the old module now? Just hit the uninstall link?

Link to comment
Share on other sites

Well normally the upgrade process should work perfectly smoothly by following the "check for updates" link in the module config, but because of the incorrect folder issue, I would recommend uninstalling and deleting the old version and installing the new version from scratch - everything should be fine after that.

Yep - click the uninstall link and then back on the main modules page you can click the delete button to remove the module completely, before installing the new version.

Edited by adrian
Link to comment
Share on other sites

ok, thanks. i've got to nip out for an hour but will do this when i get back. if all goes well i have about 15 more videos to upload so i'll give you an update on how the new module performs.

Thanks for all your help.

db

Link to comment
Share on other sites

Thanks for all your help. After uninstalling and reinstalling it all worked well.

Plus, I've uploaded the rest of the videos and the previously mentioned error didn't show.

Awesome looking video gallery thanks to this module.

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

Hi Adrian

This is a really great module that's helped on two sites recently.

My only issue (not a huge one) is that I'm using a single image field. It, possibly unexpectedly, adds a second image (ignoring the fact that the field is set to only allow one image) whereas it might be nice for it to have the option somehow of detecting an image in that field already and not bothering adding another one.

Certainly it having 2 when it's set to only allow 1 is a little confusing :)

Link to comment
Share on other sites

Hey Pete,

Glad you like it!

Do you mean that you have more than one video link embedded on a page? Is that why it is trying to insert more than one thumbnail? Or is it because you are using "All Available", rather than "First Available"?

I don't think I actually realized that the the API ignores the max number of images setting.

I am happy to fix this, but would like to know if you are dealing with more than one video, or the "All Available" setting. 

I am also curious what you think would be the preferred behavior - I guess if I replicate the admin behavior, adding a new image would replace the last one, but that seems rather ugly if you have checked "All Available" because it will attempt to add each one, but each time deleting the last one for the latest in the options. Same would go for more than one video link in a scanned field - each image would get added, only to be later replaced.

Any thoughts on what the best logic might be here?

Link to comment
Share on other sites

Nope, just one video link (I actually applied it to a text field in my case that is solely for the video URL), so I set my image field to only allow 1 image. Soemtimes I want to set my own thumbnail though, so in those cases when I've uploaded an image of my own the module grabs a thumbnail anyway and saves it to the image field I've set to only allow one image, so I end up with two images which shouldn't be possible.

You're right, expected would be to replace the image already in there, but it would be nice (albeit tricky) to allow per-image field to somehow say "if a single image field and there is already an image in there, don't overwrite". Now there's a challenge ;) I guess the obvious way around it for my somewhat unique use case would be to have another image field and just tell my template "if manual thumbnail field has an image in it, ignore the thumbnail grabbed by the module in the other field". I'll probably go that route since I'm not sure anyone else has this need.

Link to comment
Share on other sites

Pete - I think the biggest issue with doing a check like you describe is if the video url field is changed to a different video. In that case you'd want the image to be changed. I think it would be manageable though - check if the existing image has a filename consistent with a video thumb and if it is, then replace it, but if not leave it because it was manually uploaded. But given that the default PW behavior would be to overwrite the existing image in the field, perhaps your manual thumbnail field is a better idea? It might even be nice to set a field dependency on the automatic thumb field such that it's only visible if the manual one is blank?

However that is a different issue to respecting the maxFiles setting. I can't find much about it, but there is reference to it in soma's post here:

https://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/?p=30979

Should the PW core ensure this setting is respected when uploading via the API, or should it be up to us to check? Anyone have any thoughts on this?

Link to comment
Share on other sites

  • 2 months later...

Just a quick query re. this module. Is it possible to use it for a repeater? I have a video repeater with the following fields:

  • Title
  • Date
  • Link
  • Image (thumbnail)
  • Featured (checkbox)

I was hoping that I could use this module to populate the image field for instance using the link field. Hopefully that all makes sense.

Link to comment
Share on other sites

  • 1 month later...

@adrian

Thanks so much for building this. I just installed this for a site I'm building which features a ton of vids. 

I'm not familiar with YouTube's image settings etc but in general out of the following, which is most commonly used?

maxresdefault, hqdefault, mqdefault, default, 0, 1, 2, 3

I'm tempted to pull them all in and allow my client to tag a thumbnail they wish to use. However, equally, I'd rather not take up bandwidth if I knew that by dafault, YT always has a default thumb etc.

Obviously, 0, 1, 2, 3 are also good defaults.

Link to comment
Share on other sites

Hi Peter,

Glad you are liking the module. I haven't looked at this for a while, but at the time I built this it seemed like all the options were not always available with all videos which I why I built in the "First Available" option - that way you can list all, but only grab one. Would your needs be suited by reordering the list so that "default" was listed first? That way if it is available, it will grab that one, saving you the bandwidth of downloading the maxresdefault if you don't really need it.

Link to comment
Share on other sites

Hi Peter,

Would your needs be suited by reordering the list so that "default" was listed first? 

Might be an option. I'll need to build out a few pages first. Luckily the videos my client is featuring are all cinema releases so they're almost always going to have a high res image in there.

I noticed 0,1,2,3 pull in small thumbnails as opposed to a largeish screengrab of the 0,1,2,3 frames. Presume thats a YouTube thing (tiny thumbnails Vs decent W/H images)

Link to comment
Share on other sites

I noticed 0,1,2,3 pull in small thumbnails as opposed to a largeish screengrab of the 0,1,2,3 frames. Presume thats a YouTube thing (tiny thumbnails Vs decent W/H images)

Yep, 0,1,2,3 has nothing to do with the frame the image is taken from, they are just "names" for certain thumbnails. Here is a good thread detailing all the available images:

http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

Actually on that note, I see that I am missing "sddefault", so I will add that now.

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Hi @matjazp - thanks for the request. Please try the latest version which should do what you need. If no templates are selected, then the module will still search all templates as before so the changes won't affect existing users.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Hello,

I'm trying this module for the first time.

In gallery.php I currently have:

<?php include('./_head.php'); // include header markup ?>

        <!-- main content -->            
        <h1 class='uk-width-1-1'><?php echo $title; ?></h1>
        <div id='photos' class='uk-width-medium-1-2'>
            <?php            
            foreach($pages->get('/gallery/')->images as $image) {
                $thumb = $image->size(120,90);
                echo "<a href='$image->url' data-uk-lightbox=\"{group:'image-group'}\" title='$image->description'>";    
                echo "<img src='$thumb->url' width='$thumb->width' height='$thumb->height' alt='$thumb->description' />";
                echo "</a>";
            }                
            ?>
        </div>
        <div id='videos' class='uk-width-medium-1-2'>            
            <?php            
            foreach($pages->get('/gallery/')->videos as $video) {                
                echo "<a href='$video->video_url' data-uk-lightbox=\"{group:'video-group'}\">";    
                echo "<img src='{$video->video_thumbnail_image->url}' width='120' height='90' />";
                echo "</a>";
            }                
            ?>
        </div>
        
<?php include('./_foot.php'); // include footer markup ?>

In the Gallery page (with the Gallery (gallery) template) I have :

  • a Title field,
  • an Images field,
  • and a Videos (repeater) field.

The Videos (repeater) field contains 2 fields:

  • the video_thumbnail_image field,
  • and the video_url field.

In Admin > Modules > Get Video Thumbnails:

  • for "Templates to search" -> repeater_videos and Gallery (I've tried with both, with none, and also with one or the other. Not sure if Gallery is enough.),
  • for "Fields to search" -> video_url,
  • for "Video Images Field" -> video_thumbnail_image.

(I don't know why I don't see the labels added at the top of the pages for videos, video_thumbnail_image, and video_url.)

I don't have thumbnail images added to video_thumbnail_image fields for the moment.

Perhaps it's just due to one little thing.

Edit: ProcessWire 2.7.2

Link to comment
Share on other sites

Christophe,

Is this on the same site that you gave me access to last week? Let me know and if you mind me taking another look - it might be the easiest way for me to decipher where things are going wrong for you.

  • Like 1
Link to comment
Share on other sites

Sorry, I just looked at your site and realized you are using the video_url field inside a repeater. I should have noticed that from your original post above. The module doesn't currently support repeaters - I never had a need for it and no-one else has asked yet. I'll see what I can do about adding it and will get back to you when it's working.

Completely wrong - it does already support repeaters - you just need to specify the template of the repeater in the "Templates to search" config setting. 

The problem with the module on your site was due to fopen not working on files at external URLs. The current version should now work on your server.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...