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
filedirectly toResizePhotoJobdoesn't work for me as jobs don't seem to be able to acceptActiveStorage::Attached::Oneas a param.file.attachmentworks though (passing aActiveStorage::Attachmentinstead).Do you know if calling
processedon the variant will also queue up anAnalyzeJobfor the variant blob? Or should we also callvariant.blob.analyzeinResizePhotoJob?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
AnalyzeJobfor the variant does get queued whenprocessedis called, not sure how quickly it occurs though. Maybe callinganalyzeafterprocessedin the job would be wise.