Files
trpic/web/templates/component/img_setting.tmpl
Hubert Chen b3688a9a88 allow add image via upload or from link
utils:
    add `SaveFile()` function to save file to a path
image:
    add empty file ext check for inspect backends
actions:
    allow save image from link
api:
    `POSTArtworksIDFiles()` function allow upload image from link
scripts:
    implement image upload from link or file in `preview` and `artwork_id`
    fix `artwork_id` redirect bug
template/img_setting:
    add upload elements
    adjust styles
2026-04-20 21:45:06 +08:00

72 lines
1.8 KiB
Cheetah

{{ define "img_setting" }}
<style>
#img-setting::before { content: "设置" }
#img-setting > div {
display: flex;
gap: .2em;
max-width: 100%;
margin-block: .5em;
flex-wrap: wrap;
}
#sensitive-select,
#private-select,
#setting-button,
#post-input,
#post-button,
#upload-file-button::file-selector-button,
#upload-url-input,
#upload-button {
color: white;
background-color: rgb(50, 50, 50);
border-radius: .2em;
border: none;
padding: .2em .5em;
}
#setting-button:hover,
#post-button:hover,
#upload-file-button::file-selector-button:hover,
#upload-button:hover {
background-color: rgb(40, 40, 40);
}
#setting-button:active,
#post-button:active,
#upload-file-button::file-selector-button:active,
#upload-button:active {
background-color: rgb(50, 50, 50);
}
#upload-file-button {
min-width: 100%;
}
</style>
<span id="img-setting" style="display:none">
<div>
<select id="sensitive-select">
<option value="0">safe</option>
<option value="1">little</option>
<option value="2">slightly</option>
<option value="3">innuendo</option>
<option value="4">explicit</option>
<option value="5">violence</option>
</select>
<select id="private-select">
<option value="false">public</option>
<option value="true">private</option>
</select>
<input id="setting-button" type="button" value="save"/>
</div>
<div>
<input id="post-input" type="url" size="10" placeholder="add post link..." required />
<input id="post-button" type="button" value="add" />
</div>
<div>
<input id="upload-file-button" type="file" multiple accept="image/*" name="上传文件" >
<input id="upload-url-input" type="url" size="10" placeholder="file link..." >
<input id="upload-button" type="button" value="上传">
</div>
{{ end }}