0

I'm importing videos and video thumbnails from a legacy site. A lot of video thumbnail have black boxes at the top and bottom due to the aspect ratio of the videos, for example:

enter image description here

I would like to crop all video thumbnails to remove those bars. I haven't done it yet but assume it's pretty easy to just modify the image style for "thumbnail".

Now, any new videos that will be uploaded (using the video module) or any of the images that use the thumbnail style don't need to be cropped that way. If I would change the image style for "thumbnail" after all videos are imported then I would lose the crop effect, right?

How can I solve this problem? I'm displaying all video thumbnails using views. Do I need to do a template override where I manually apply a different image style to those "legacy" videos?

1

You can put more than one filter on a preset, so it is possible, depending on the aspect ratio of the new and the old, that you can add a first filter that will remove the black bands and a second that will change the size.

Otherwise, you might try programmatically making image style change the aspect ratio of all your old images, deleting your old images, then copying the images in your changed image style directory to your root file directory. Image styles doesn't change the name of the file.

If either of those options doesn't work for you, you can create a custom field formatter that looks at the file id and decides which image style preset to use (as you suggested above except don't so this in the theme system as the new formatter would be available to any node view as well as in the views module). See: http://www.computerminds.co.uk/articles/creating-new-field-formatters-drupal-7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.