mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-15 06:13:43 -06:00
migration from showsize tag to showfull tag for simpler use experience
This commit is contained in:
@@ -121,20 +121,18 @@ def hidden(id):
|
|||||||
return '\"count\" parameter must be Integer.<br>Invalid \"count\": \"{}\"'.format(request.args.get('count'))
|
return '\"count\" parameter must be Integer.<br>Invalid \"count\": \"{}\"'.format(request.args.get('count'))
|
||||||
base64 = boolparse(request.args.get('base64'))
|
base64 = boolparse(request.args.get('base64'))
|
||||||
# Handled within Jinja template
|
# Handled within Jinja template
|
||||||
print(request.args.get('showsample'))
|
showfull = boolparse(request.args.get('showfull'))
|
||||||
showsample = boolparse(request.args.get('showsample'), default=True)
|
|
||||||
showtags = boolparse(request.args.get('showtags'))
|
showtags = boolparse(request.args.get('showtags'))
|
||||||
# Request, Parse & Build Data
|
# Request, Parse & Build Data
|
||||||
data = trap(tags, page, count, base64, showsample)
|
data = trap(tags, page, count, base64, showfull)
|
||||||
print(showsample)
|
return render_template('hidden.html', title='Gelbooru', data=data, base64=base64, showfull=showfull, showtags=showtags)
|
||||||
return render_template('hidden.html', title='Gelbooru', data=data, base64=base64, showsample=showsample, showtags=showtags)
|
|
||||||
|
|
||||||
def base64ify(url):
|
def base64ify(url):
|
||||||
return base64.b64encode(requests.get(url).content).decode()
|
return base64.b64encode(requests.get(url).content).decode()
|
||||||
|
|
||||||
gelbooru_url = "https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={}&pid={}&limit={}"
|
gelbooru_url = "https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={}&pid={}&limit={}"
|
||||||
|
|
||||||
def trap(tags, page, count, base64, showsample):
|
def trap(tags, page, count, base64, showfull):
|
||||||
# URL Building & Request
|
# URL Building & Request
|
||||||
temp = gelbooru_url.format(tags, page, count)
|
temp = gelbooru_url.format(tags, page, count)
|
||||||
response = requests.get(temp).text
|
response = requests.get(temp).text
|
||||||
@@ -150,7 +148,7 @@ def trap(tags, page, count, base64, showsample):
|
|||||||
'tags' : element['@tags']
|
'tags' : element['@tags']
|
||||||
}
|
}
|
||||||
if base64:
|
if base64:
|
||||||
if showsample:
|
if not showfull:
|
||||||
temp['base64'] = base64ify(temp['sample_url'])
|
temp['base64'] = base64ify(temp['sample_url'])
|
||||||
else:
|
else:
|
||||||
temp['base64'] = base64ify(temp['real_url'])
|
temp['base64'] = base64ify(temp['real_url'])
|
||||||
|
|||||||
@@ -45,15 +45,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="base64">Use base64 encoding?</label>
|
<label for="base64">Use base64 encoding?</label>
|
||||||
<input type="checkbox" name="base64" />
|
<input type="checkbox" name="base64" value="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="showsample">Show sample (thumbnail image)?</label>
|
<label for="showsample">Show fullsize (instead of thumbnail image)?</label>
|
||||||
<input type="checkbox" name="showsample" />
|
<input type="checkbox" name="showfull" value="true"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="showtags">Show tags of image?</label>
|
<label for="showtags">Show tags of image?</label>
|
||||||
<input type="checkbox" name="showtags" />
|
<input type="checkbox" name="showtags" value="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="columns is-centered">
|
<div class="columns is-centered">
|
||||||
<div class="column is-4">
|
<div class="column is-4">
|
||||||
@@ -85,10 +85,10 @@
|
|||||||
{% if base64 %}
|
{% if base64 %}
|
||||||
<img src="data:image/png;base64,{{ image.base64 }}">
|
<img src="data:image/png;base64,{{ image.base64 }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if showsample %}
|
{% if showfull %}
|
||||||
<img src="{{ image.sample_url }}">
|
|
||||||
{% else %}
|
|
||||||
<img src="{{ image.real_url }}" alt="{{ image.sample_url }}">
|
<img src="{{ image.real_url }}" alt="{{ image.sample_url }}">
|
||||||
|
{% else %}
|
||||||
|
<img src="{{ image.sample_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</figure>
|
</figure>
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ It's maxmimum value is <code>1000</code>.</p>
|
|||||||
|
|
||||||
<p>The <code>count</code> parameter specifies how many images will load on the page at once.<br>
|
<p>The <code>count</code> parameter specifies how many images will load on the page at once.<br>
|
||||||
It is recommended you do not exceed <code>100</code>, as most images will not load past this.<br>
|
It is recommended you do not exceed <code>100</code>, as most images will not load past this.<br>
|
||||||
When <code>base64</code> is enabled, count is automatically set back to <code>25</code> to stop server load, unless <code>showsample</code> is enabled, where it will be set to <code>50</code>.</p>
|
When <code>base64</code> is enabled, count is automatically set back to <code>50</code> to stop server load, unless <code>showfull</code> is enabled, where it will be set to <code>25</code>.</p>
|
||||||
<h5 class="mume-header" id="example-1">Example</h5>
|
<h5 class="mume-header" id="example-1">Example</h5>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@@ -348,33 +348,34 @@ will load <code>50</code> images using <code>base64</code> encoding.</p>
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
<h4 class="mume-header" id="showsample-parameter"><code>showsample</code> parameter</h4>
|
<h4 class="mume-header" id="showfull-parameter"><code>showfull</code> parameter</h4>
|
||||||
|
|
||||||
<h5 class="mume-header" id="type-2">Type</h5>
|
<h5 class="mume-header" id="type-2">Type</h5>
|
||||||
|
|
||||||
<p>The <code>showsample</code> parameter is a boolean.<br>
|
<p>The <code>showfull</code> parameter is a boolean.<br>
|
||||||
As usual, it expects some form of <code>True</code>, <code>False</code>, <code>0</code>, or <code>1</code>.<br>
|
As usual, it expects some form of <code>True</code>, <code>False</code>, <code>0</code>, or <code>1</code>.<br>
|
||||||
The parameter is not case sensitive.<br>
|
The parameter is not case sensitive.<br>
|
||||||
<code>showsample</code> defaults to <code>True</code> if not specified.</p>
|
<code>showfull</code> defaults to <code>False</code> if not specified.</p>
|
||||||
<h5 class="mume-header" id="description-2">Description</h5>
|
<h5 class="mume-header" id="description-2">Description</h5>
|
||||||
|
|
||||||
<p>The <code>showsample</code> parameter is very simple.<br>
|
<p>The <code>showfull</code> parameter is very simple.<br>
|
||||||
|
This requests that the page load with high quality images instead of the default thumbnail quality image.<br>
|
||||||
The Gelbooru API provides multiple links for any given image, one of which is a link for the thumnbail.<br>
|
The Gelbooru API provides multiple links for any given image, one of which is a link for the thumnbail.<br>
|
||||||
The Gelbooru site staff prefer that sites like mine link to the thumbnail image, of which this parameter does. The thumnbail image is of significantly lower quality, but it lowers loading time for both you, as well as reduce load on the Gelbooru CDN. Out of respect for them, we ask that this parameter be kept on, as to view the full high quality version of the image, you need but click on the image itself.</p>
|
The Gelbooru site staff prefer that sites like mine link to the thumbnail image, of which this parameter does. The thumnbail image is of significantly lower quality, but it lowers loading time for both you, as well as reduce load on the Gelbooru CDN. Out of respect for them, we ask that this parameter be kept on, as to view the full high quality version of the image, you need but click on the image itself.</p>
|
||||||
<h5 class="mume-header" id="example-2">Example</h5>
|
<h5 class="mume-header" id="example-2">Example</h5>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p><code>/hidden?showsample=True</code><br>
|
<p><code>/hidden?showfull=True</code><br>
|
||||||
shows all images in thumbnail quality</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p><code>/hidden?showsample=False</code><br>
|
|
||||||
shows all images in high quality</p>
|
shows all images in high quality</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p><code>hidden/showsample=0&base64=True</code><br>
|
<p><code>/hidden?showfull=False</code><br>
|
||||||
shows all images in high quality using <code>base64</code> encoding</p>
|
shows all images in thumbnail quality</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><code>hidden/showfull=0&base64=True</code><br>
|
||||||
|
shows all images in thumnbnail quality using <code>base64</code> encoding</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ It's maxmimum value is `1000`.
|
|||||||
|
|
||||||
The `count` parameter specifies how many images will load on the page at once.
|
The `count` parameter specifies how many images will load on the page at once.
|
||||||
It is recommended you do not exceed `100`, as most images will not load past this.
|
It is recommended you do not exceed `100`, as most images will not load past this.
|
||||||
When `base64` is enabled, count is automatically set back to `25` to stop server load, unless `showsample` is enabled, where it will be set to `50`.
|
When `base64` is enabled, count is automatically set back to `50` to stop server load, unless `showfull` is enabled, where it will be set to `25`.
|
||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
@@ -93,31 +93,32 @@ will load `50` images using `base64` encoding.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
#### `showsample` parameter
|
#### `showfull` parameter
|
||||||
|
|
||||||
##### Type
|
##### Type
|
||||||
|
|
||||||
The `showsample` parameter is a boolean.
|
The `showfull` parameter is a boolean.
|
||||||
As usual, it expects some form of `True`, `False`, `0`, or `1`.
|
As usual, it expects some form of `True`, `False`, `0`, or `1`.
|
||||||
The parameter is not case sensitive.
|
The parameter is not case sensitive.
|
||||||
`showsample` defaults to `True` if not specified.
|
`showfull` defaults to `False` if not specified.
|
||||||
|
|
||||||
##### Description
|
##### Description
|
||||||
|
|
||||||
The `showsample` parameter is very simple.
|
The `showfull` parameter is very simple.
|
||||||
|
This requests that the page load with high quality images instead of the default thumbnail quality image.
|
||||||
The Gelbooru API provides multiple links for any given image, one of which is a link for the thumnbail.
|
The Gelbooru API provides multiple links for any given image, one of which is a link for the thumnbail.
|
||||||
The Gelbooru site staff prefer that sites like mine link to the thumbnail image, of which this parameter does. The thumnbail image is of significantly lower quality, but it lowers loading time for both you, as well as reduce load on the Gelbooru CDN. Out of respect for them, we ask that this parameter be kept on, as to view the full high quality version of the image, you need but click on the image itself.
|
The Gelbooru site staff prefer that sites like mine link to the thumbnail image, of which this parameter does. The thumnbail image is of significantly lower quality, but it lowers loading time for both you, as well as reduce load on the Gelbooru CDN. Out of respect for them, we ask that this parameter be kept on, as to view the full high quality version of the image, you need but click on the image itself.
|
||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
* `/hidden?showsample=True`
|
* `/hidden?showfull=True`
|
||||||
shows all images in thumbnail quality
|
|
||||||
|
|
||||||
* `/hidden?showsample=False`
|
|
||||||
shows all images in high quality
|
shows all images in high quality
|
||||||
|
|
||||||
* `hidden/showsample=0&base64=True`
|
* `/hidden?showfull=False`
|
||||||
shows all images in high quality using `base64` encoding
|
shows all images in thumbnail quality
|
||||||
|
|
||||||
|
* `hidden/showfull=0&base64=True`
|
||||||
|
shows all images in thumnbnail quality using `base64` encoding
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user