-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/nonimage thumbnail #28
Conversation
- before Thread could exit, we may be already processing queue.pop - this means, "threads.any?(&:alive?)" might return a misleading "true" and endless wait for "until queue.pop..."
- all non-image (including pdf; watch out #2) are rendered as a "polaroid" - with filename as caption
a8ba3ee
to
6f6ec5d
Compare
6f6ec5d
to
9826af3
Compare
Some questions
What happens if the filename is long? Will the polaroid look ugly?
From a design perspective, not sure if this is desirable, because then normal images are not polaroid-ed and doesn't have the shadow, while others are polaroid-ed and have the shadow. If I want to achieve consistency, then I can't really get rid of the shadow because it's already part of the image. Right?
Also, the thumbnail size for non images are fixed? Meaning I can't specify it from |
Correct. I'd change it to a more minimal "file icon" look if I can just sort out the commands :-P otherwise, maybe i'll just introduce black/white border (it is ultimately still a styled image, albeit minimally so)
Correct. Though the file extension icons wouldn't look good |
- milder color - fix border so pdf and other files have same width 132px
👍 |
threads = lambdas.shuffle.collect { |code| Thread.new { queue << [Thread.current, code.call] } } | ||
until (item = queue.pop).last do | ||
thread, _ = item | ||
thread.join # we could be popping `queue` before thread exited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@winston note that this join
fixes the problem of attache server hanging
- in the
Thread.new
code above, we doqueue << ...
and then the thread exits - but the processing of
queue.pop
could happen before the thread exits - thus,
break unless threads.any?(&:alive?)
incorrectly account for the soon-to-be-exited thread - the fix is to explicitly
join
that thread, before we checkthreads.any?(&:alive?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
background: my own app uses the dynamic image/resizing features as well as the document/file storage features. when users upload documents alongside images, the resized images shows up nicely but document files are presented as icons. @abitdodgy since your work revolves around just document and file storage, I was wondering if you'd care to chime in on such a feature (for an image server) |
Sample rendering of png, pdf, xlsx and zip files
original
geometry string in the urlthis behavior is useful in apps, since we can just upload files and use
<img src=...>
directly without special code.