Giter Club home page Giter Club logo

Comments (23)

ttseng avatar ttseng commented on June 20, 2024 4

I solved this issue by overriding the process set_content_type as follows:

require 'carrierwave/processing/mime_types'

class VideoPathUploader < CarrierWave::Uploader::Base
include CarrierWave::Video
include CarrierWave::Video::Thumbnailer
include CarrierWave::MimeTypes

version :thumb do
process thumbnail: [{format: 'png', quality: 10, size: 158, logger: Rails.logger}]
def full_filename for_file
png_name for_file, version_name
end
process :set_content_type_png
# process resize_to_limit: [105, 158]
end

def set_content_type_png(*args)
Rails.logger.debug "#{file.content_type}"
self.file.instance_variable_set(:@content_type, "image/png")
end

end

I had to do this for all file types (I was using the carrierwave-video gem to convert video file types, so I had to define processes for each file type I created). It's a bit hacky, but it worked for me.

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

Thanx for the question. I’ll try to help you asap.

from carrierwave-video-thumbnailer.

rilian avatar rilian commented on June 20, 2024

Please check if the official doc help on this https://github.com/carrierwaveuploader/carrierwave#setting-the-content-type

from carrierwave-video-thumbnailer.

ttseng avatar ttseng commented on June 20, 2024

I have the same problem. My image files have a content-type of video/quicktime on amazon s3. I've added

require 'carrierwave/processing/mime_types'
include CarrierWave::MimeTypes

and

process :set_content_type

but it did not fix the problem. Did anyone figure out how to solve it?

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

I’ll try to, thank you.

2013/10/23 ttseng [email protected]

I have the same problem. My image files have a content-type of
video/quicktime on amazon s3. I've added

require 'carrierwave/processing/mime_types'
include CarrierWave::MimeTypes

and

process :set_content_type

but it did not fix the problem. Did anyone figure out how to solve it?


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-26861570
.

Yours truly, Pavel.

from carrierwave-video-thumbnailer.

ttseng avatar ttseng commented on June 20, 2024

were you able to resolve the issue?

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

Not yet. This week perhaps...

2013/10/28 ttseng [email protected]

were you able to resolve the issue?


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-27187993
.

Yours truly, Pavel.

from carrierwave-video-thumbnailer.

hyperrjas avatar hyperrjas commented on June 20, 2024

+1

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

Thanks. I’ll probably use some of it.

2013/11/18 ttseng [email protected]

I solved this issue by overriding the process set_content_type as follows:

require 'carrierwave/processing/mime_types'

class VideoPathUploader < CarrierWave::Uploader::Base
include CarrierWave::Video
include CarrierWave::Video::Thumbnailer
include CarrierWave::MimeTypes

version :thumb do
process thumbnail: [{format: 'png', quality: 10, size: 158, logger:
Rails.logger}]

def full_filename for_file
png_name for_file, version_name
end
process :set_content_type_png

process resize_to_limit: [105, 158]

end

def set_content_type_png(*args)
Rails.logger.debug "#{file.content_type}"
self.file.instance_variable_set(:@content_type, "video/png")
end

end

I had to do this for all file types (I was using the carrierwave-video gem
to convert video file types, so I had to define processes for each file
type I created). It's a bit hacky, but it worked for me.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-28664696
.

Yours truly, Pavel.

from carrierwave-video-thumbnailer.

rakesh050791 avatar rakesh050791 commented on June 20, 2024

I am still facing the same issue. After using the above code I am getting the below error:

NoMethodError (undefined method `each' for "image/png":String):

Any help would be appreciated.

Thanks
Rakesh

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

@ttseng would you please help clarifying @rakesh050791 ’s Q? I hope I’ll fix it in the library asap.

from carrierwave-video-thumbnailer.

rakesh050791 avatar rakesh050791 commented on June 20, 2024

Hello smith,

As we need the thumbnail for the video uploaded in our rails application. we are using this library for the same, but we are unable to reach at our goal.

we are using carrierwave for video uploading. but by using the code mentioned in the library for thumbnail, we are not getting the exact thumbnail for the same video.

I am attaching my video uploader screen , please see.

video_uploader

Quick reply would be appreciated.

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

we are not getting the exact thumbnail for the same video

Do you mean you see a thumbnail of a different video or what?

from carrierwave-video-thumbnailer.

rakesh050791 avatar rakesh050791 commented on June 20, 2024

I mean to say, i am getting the response like this

response

Please see, the url i'am getting for the video uploaded, the same url i am getting in the thumb, but this is not to be done Pavel .

Please ignore the above thumb : "" parameter, this one is my database column. made later

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

Does your version of ffmpeg/ffmpegthumbnailer support the format you use (3gp)?

from carrierwave-video-thumbnailer.

rakesh050791 avatar rakesh050791 commented on June 20, 2024

I have tried with mp 4 also and i've installed ffmpegthumbnailer today itself.

Could you please update me how can i check this ?

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

Just be sure it supports all the needed formats. Also, it’d be a great help if you try CLI-run of ffmpegthumbnailer on the sample file of the offending format and show me the CLI output. Thanks in advance!

from carrierwave-video-thumbnailer.

00dav00 avatar 00dav00 commented on June 20, 2024

Just run into the same issue and @ttseng fix worked for me, are you planning to fix this anytime soon or accepting PRs for this?

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

@rakesh050791 @00dav00 thnx for the report ❤️ . Will decide ASAP.

from carrierwave-video-thumbnailer.

damujay avatar damujay commented on June 20, 2024

HI argent-smith , Actually i am facing with video thumbnail issue.

my issue) when i uploading a video , the thumbnail image is stretching.FOr youtube videos ,it's fine but if it's system videos,the thumbnails is stretching. I am using carrier wave gaem.Following is the my code base.

` include CarrierWave::Video # for your video processing
include CarrierWave::Video::Thumbnailer

version :medium, if: :image? do
process :remove_animation, if: :gif?
process :resize_to_limit => [500, 500]
end

version :thumb, if: :video? do
process thumbnail: [{format: 'png', quality: 10, size: "500%", seek: "00:00:03", logger: Rails.logger}]
def full_filename for_file
png_name for_file, version_name
end

def png_name for_file, version_name
  %Q{#{version_name}_#{for_file.chomp(File.extname(for_file))}.png}
end

end
`

CAn you please suggest me on this?

Thank you un advance

from carrierwave-video-thumbnailer.

gregblass avatar gregblass commented on June 20, 2024

The Mime Types feature was removed from carrierwave. As of now it seems impossible to set the mime type correctly using this gem, resulting in thumbnails not displaying from on iOS.

EDIT: False alarm! You don't need to include the mime type carrierwave stuff. Just set the content type in a :process method. I just wasn't actually sending it to S3 in dev!

from carrierwave-video-thumbnailer.

argent-smith avatar argent-smith commented on June 20, 2024

Thnx for notice. I'll see what could be done with this.

from carrierwave-video-thumbnailer.

araslanov-e avatar araslanov-e commented on June 20, 2024

Helped me #15 (comment)

from carrierwave-video-thumbnailer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.