Comments (7)
Maybe a configuration query that looks this:
select binary_content from files where key = :key
from datasette-media.
I tested this branch with a files.db
database with the following table and it worked:
CREATE TABLE [photos] (
[key] TEXT,
[contents] BLOB
);
Then this in metadata.json
:
{
"plugins": {
"datasette-media": {
"photo_from_db": {
"sql": "select contents as binary_content from photos where key=:key",
"database": "files"
}
}
}
}
Images were then served from http://127.0.0.1:8001/-/media/photo_from_db/key-for-image
from datasette-media.
This could also be made available as one or more output renderers, which you would enable in the config:
{
"plugins": {
"datasette-media": {
"enable-output-renderer": true
}
}
}
This could add .raw
which dumps out the raw data.
Needs to be done carefully - don't want to accidentally open up HTML injection attacks (people who request .raw
for select '<b>evil_html</b>' as output
).
from datasette-media.
This should be compatible with https://www.sqlite.org/sqlar.html - which can store files using DEFLATE
compression.
from datasette-media.
sqlite-utils 2.12
is out now with the new insert-files
command, useful for testing this issue.
from datasette-media.
Don't forget to update this paragraph at the top of the README:
Use this when you have a database table containing references to files on disk that you would like to be able to serve to your users.
from datasette-media.
One way to support sqlar: allow a should_deflate
column to be returned which tells the plugin to run deflate on the content
.
Custom queries against sqlar can then use length(content) < Szabo as should_deflate
from datasette-media.
Related Issues (20)
- Get libheif and pyheif to install correctly in Circle CI HOT 3
- default_convert plugins metadata setting
- Make compatible with Datasette 0.45
- Do something smart with etags
- Consider caching resized versions in a sqlite table
- Refactor code to support different sources HOT 3
- Ability to trigger browser downloads with a content_filename column HOT 3
- Feature idea: configurable media serving domain
- content_url, when not transformed, should async proxy through rather than loading into memory HOT 6
- content_type column for setting the content type HOT 2
- More efficient blob serving using SQLite incremental BLOBs
- media-key with spaces are not unquoted
- 500 error if content is blank HOT 1
- Support URL proxying HOT 2
- SQL columns controlling resize/reformat HOT 7
- "enable_transform" in plugin configuration HOT 5
- Default to stripping EXIF data
- Serve mp4 video that can be viewed in a browser HOT 1
- Add PyPY project links
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datasette-media.