Passing file directly to ResizePhotoJob doesn't work for me as jobs don't seem to be able to accept ActiveStorage::Attached::One as a param. file.attachment works though (passing a ActiveStorage::Attachment instead).
Do you know if calling processed on the variant will also queue up an AnalyzeJob for the variant blob? Or should we also call variant.blob.analyze in ResizePhotoJob?
As well as the variant being created in a background job before the user requests it, I want that variant to be analyzed too so that the dimensions metadata is available before first request.
Hey !
I think the AnalyzeJob is called when the upload is done. I should dive on the rails code to be sure.
Meanwhile, The meta data is needed to know if it’s an image, pdf or a regular file.
This data is also needed to choose the right processor to compress or resize.
So this should be done as soon as possible ( technically just after the upload is done )
I believe AnalyzeJob for the variant does get queued when processed is called, not sure how quickly it occurs though. Maybe calling analyze after processed in the job would be wise.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice!
Passing
file
directly toResizePhotoJob
doesn't work for me as jobs don't seem to be able to acceptActiveStorage::Attached::One
as a param.file.attachment
works though (passing aActiveStorage::Attachment
instead).Do you know if calling
processed
on the variant will also queue up anAnalyzeJob
for the variant blob? Or should we also callvariant.blob.analyze
inResizePhotoJob
?As well as the variant being created in a background job before the user requests it, I want that variant to be analyzed too so that the dimensions metadata is available before first request.
Hey !
I think the AnalyzeJob is called when the upload is done. I should dive on the rails code to be sure.
Meanwhile, The meta data is needed to know if it’s an image, pdf or a regular file.
This data is also needed to choose the right processor to compress or resize.
So this should be done as soon as possible ( technically just after the upload is done )
I believe
AnalyzeJob
for the variant does get queued whenprocessed
is called, not sure how quickly it occurs though. Maybe callinganalyze
afterprocessed
in the job would be wise.