aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-01 00:22:43 -0500
committerBobby <[email protected]>2022-12-01 00:22:43 -0500
commit57a1b08473a172e53ee19cacfc4d8b17eb77bdad (patch)
treea011afc0d385ad8f62ad7a9764583a2cfaef6e7f
parent86923f4edf2a2fdc180e6ffe5eea368a6a6d91f6 (diff)
downloadthatcomputerscientist-57a1b08473a172e53ee19cacfc4d8b17eb77bdad.tar.xz
thatcomputerscientist-57a1b08473a172e53ee19cacfc4d8b17eb77bdad.zip
Add Image URL Extensions
-rw-r--r--ignis/urls.py2
-rw-r--r--ignis/views.py2
-rw-r--r--templates/blog/post.html2
-rw-r--r--templates/dev_status/home.html2
4 files changed, 5 insertions, 3 deletions
diff --git a/ignis/urls.py b/ignis/urls.py
index ea0e3b66..b190a40f 100644
--- a/ignis/urls.py
+++ b/ignis/urls.py
@@ -4,7 +4,7 @@ from . import views
app_name = 'ignis'
urlpatterns = [
path('/tex', views.tex, name='tex'),
- path('/post_image/<int:post_id>/', views.post_image, name='post_image'),
+ path('/post_image/<str:post_id>', views.post_image, name='post_image'),
path('/upload', views.upload_image, name='upload_image'),
path('/image/<post_id>/<image_name>', views.get_image, name='get_image'),
path('/cover/<str:repository>', views.cover_image, name='cover_image'),
diff --git a/ignis/views.py b/ignis/views.py
index 0bd878fe..a3f7d479 100644
--- a/ignis/views.py
+++ b/ignis/views.py
@@ -35,6 +35,7 @@ def tex(request):
@csrf_exempt
def post_image(request, post_id):
+ post_id = post_id.replace('.png', '')
pi = Post.objects.get(id=post_id).post_image
if not pi:
return HttpResponse('No image found!', status=404)
@@ -64,6 +65,7 @@ def get_image(request, post_id, image_name):
@csrf_exempt
def cover_image(request, repository):
force_reload = request.GET.get('force_reload')
+ repository = repository.replace('.gif', '')
# check if the image is in RepositoryTitles
try:
if force_reload:
diff --git a/templates/blog/post.html b/templates/blog/post.html
index b4055ac4..26901f02 100644
--- a/templates/blog/post.html
+++ b/templates/blog/post.html
@@ -9,7 +9,7 @@
{% load subdomain %}
<div class="article-cover">
{% url 'ignis:post_image' post.id as cover_url %}
- <img src="{{ cover_url|subdomain:'ignis' }}" alt="Cover Image" style="width: 720px; margin: 0 auto; display: block;">
+ <img src="{% url 'ignis:post_image' post.id %}.png" alt="Cover Image" style="width: 720px; margin: 0 auto; display: block;">
</div>
<h1 style="margin-bottom: 12px; font-size: 2rem;">{{ post.title }}</h1>
<p style="line-height: 1.6em;">
diff --git a/templates/dev_status/home.html b/templates/dev_status/home.html
index d4f612a9..7fa8bf06 100644
--- a/templates/dev_status/home.html
+++ b/templates/dev_status/home.html
@@ -51,7 +51,7 @@
{% for repo in repos %}
<tr>
<td><a href="{% url 'dev_status:repo' repo.name %}">
- <img src="{% url 'ignis:cover_image' repo.name %}" style="display: inline-block; margin-right: 10px;" class="zoom">
+ <img src="{% url 'ignis:cover_image' repo.name %}.gif" style="display: inline-block; margin-right: 10px;" class="zoom">
</a>
</td>
<td>