Skip to content

Commit 032beff

Browse files
committed
website-update-newhomepage
1 parent d6d01d5 commit 032beff

File tree

163 files changed

+4603
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+4603
-4
lines changed

app/models.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Album(models.Model):
1313
flickr_url = models.URLField(default='', help_text='Link to Flick Photo Ablum', blank=True,)
1414
album_link = models.URLField(help_text='Link to Photo Ablum', blank=False,)
1515
googlephotos_url = models.URLField(default='', help_text='Link to Google Photo Ablum', blank=True,)
16-
thumb = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(300)], format='JPEG', options={'quality': 90})
16+
thumb = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(300)], format='jpg', options={'quality': 90})
1717
tags = models.CharField(max_length=250)
1818
is_visible = models.BooleanField(default=True)
1919
created = models.DateTimeField(auto_now_add=True)
@@ -27,8 +27,8 @@ def __unicode__(self):
2727
return self.title
2828

2929
class AlbumImage(models.Model):
30-
image = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(1280)], format='JPEG', options={'quality': 70})
31-
thumb = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(300)], format='JPEG', options={'quality': 80})
30+
image = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(1280)], format='jpg', options={'quality': 70})
31+
thumb = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(300)], format='jpg', options={'quality': 80})
3232
album = models.ForeignKey('album')
3333
alt = models.CharField(max_length=255, default=uuid.uuid4)
3434
created = models.DateTimeField(auto_now_add=True)

gallery/.coveragerc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
omit =
3+
*/tests/*
4+
*/runtests.py

gallery/.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dist: xenial
2+
language: python
3+
python:
4+
- "3.6"
5+
install:
6+
- ./build.sh
7+
- pip install --find-links ./django-starcross-gallery/dist django-starcross-gallery
8+
- pip install coveralls
9+
script:
10+
- coverage run --source=gallery runtests.py
11+
after_success:
12+
- coveralls

gallery/LICENSE

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5+
Everyone is permitted to copy and distribute verbatim copies
6+
of this license document, but changing it is not allowed.
7+
8+
9+
This version of the GNU Lesser General Public License incorporates
10+
the terms and conditions of version 3 of the GNU General Public
11+
License, supplemented by the additional permissions listed below.
12+
13+
0. Additional Definitions.
14+
15+
As used herein, "this License" refers to version 3 of the GNU Lesser
16+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
17+
General Public License.
18+
19+
"The Library" refers to a covered work governed by this License,
20+
other than an Application or a Combined Work as defined below.
21+
22+
An "Application" is any work that makes use of an interface provided
23+
by the Library, but which is not otherwise based on the Library.
24+
Defining a subclass of a class defined by the Library is deemed a mode
25+
of using an interface provided by the Library.
26+
27+
A "Combined Work" is a work produced by combining or linking an
28+
Application with the Library. The particular version of the Library
29+
with which the Combined Work was made is also called the "Linked
30+
Version".
31+
32+
The "Minimal Corresponding Source" for a Combined Work means the
33+
Corresponding Source for the Combined Work, excluding any source code
34+
for portions of the Combined Work that, considered in isolation, are
35+
based on the Application, and not on the Linked Version.
36+
37+
The "Corresponding Application Code" for a Combined Work means the
38+
object code and/or source code for the Application, including any data
39+
and utility programs needed for reproducing the Combined Work from the
40+
Application, but excluding the System Libraries of the Combined Work.
41+
42+
1. Exception to Section 3 of the GNU GPL.
43+
44+
You may convey a covered work under sections 3 and 4 of this License
45+
without being bound by section 3 of the GNU GPL.
46+
47+
2. Conveying Modified Versions.
48+
49+
If you modify a copy of the Library, and, in your modifications, a
50+
facility refers to a function or data to be supplied by an Application
51+
that uses the facility (other than as an argument passed when the
52+
facility is invoked), then you may convey a copy of the modified
53+
version:
54+
55+
a) under this License, provided that you make a good faith effort to
56+
ensure that, in the event an Application does not supply the
57+
function or data, the facility still operates, and performs
58+
whatever part of its purpose remains meaningful, or
59+
60+
b) under the GNU GPL, with none of the additional permissions of
61+
this License applicable to that copy.
62+
63+
3. Object Code Incorporating Material from Library Header Files.
64+
65+
The object code form of an Application may incorporate material from
66+
a header file that is part of the Library. You may convey such object
67+
code under terms of your choice, provided that, if the incorporated
68+
material is not limited to numerical parameters, data structure
69+
layouts and accessors, or small macros, inline functions and templates
70+
(ten or fewer lines in length), you do both of the following:
71+
72+
a) Give prominent notice with each copy of the object code that the
73+
Library is used in it and that the Library and its use are
74+
covered by this License.
75+
76+
b) Accompany the object code with a copy of the GNU GPL and this license
77+
document.
78+
79+
4. Combined Works.
80+
81+
You may convey a Combined Work under terms of your choice that,
82+
taken together, effectively do not restrict modification of the
83+
portions of the Library contained in the Combined Work and reverse
84+
engineering for debugging such modifications, if you also do each of
85+
the following:
86+
87+
a) Give prominent notice with each copy of the Combined Work that
88+
the Library is used in it and that the Library and its use are
89+
covered by this License.
90+
91+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
92+
document.
93+
94+
c) For a Combined Work that displays copyright notices during
95+
execution, include the copyright notice for the Library among
96+
these notices, as well as a reference directing the user to the
97+
copies of the GNU GPL and this license document.
98+
99+
d) Do one of the following:
100+
101+
0) Convey the Minimal Corresponding Source under the terms of this
102+
License, and the Corresponding Application Code in a form
103+
suitable for, and under terms that permit, the user to
104+
recombine or relink the Application with a modified version of
105+
the Linked Version to produce a modified Combined Work, in the
106+
manner specified by section 6 of the GNU GPL for conveying
107+
Corresponding Source.
108+
109+
1) Use a suitable shared library mechanism for linking with the
110+
Library. A suitable mechanism is one that (a) uses at run time
111+
a copy of the Library already present on the user's computer
112+
system, and (b) will operate properly with a modified version
113+
of the Library that is interface-compatible with the Linked
114+
Version.
115+
116+
e) Provide Installation Information, but only if you would otherwise
117+
be required to provide such information under section 6 of the
118+
GNU GPL, and only to the extent that such information is
119+
necessary to install and execute a modified version of the
120+
Combined Work produced by recombining or relinking the
121+
Application with a modified version of the Linked Version. (If
122+
you use option 4d0, the Installation Information must accompany
123+
the Minimal Corresponding Source and Corresponding Application
124+
Code. If you use option 4d1, you must provide the Installation
125+
Information in the manner specified by section 6 of the GNU GPL
126+
for conveying Corresponding Source.)
127+
128+
5. Combined Libraries.
129+
130+
You may place library facilities that are a work based on the
131+
Library side by side in a single library together with other library
132+
facilities that are not Applications and are not covered by this
133+
License, and convey such a combined library under terms of your
134+
choice, if you do both of the following:
135+
136+
a) Accompany the combined library with a copy of the same work based
137+
on the Library, uncombined with any other library facilities,
138+
conveyed under the terms of this License.
139+
140+
b) Give prominent notice with the combined library that part of it
141+
is a work based on the Library, and explaining where to find the
142+
accompanying uncombined form of the same work.
143+
144+
6. Revised Versions of the GNU Lesser General Public License.
145+
146+
The Free Software Foundation may publish revised and/or new versions
147+
of the GNU Lesser General Public License from time to time. Such new
148+
versions will be similar in spirit to the present version, but may
149+
differ in detail to address new problems or concerns.
150+
151+
Each version is given a distinguishing version number. If the
152+
Library as you received it specifies that a certain numbered version
153+
of the GNU Lesser General Public License "or any later version"
154+
applies to it, you have the option of following the terms and
155+
conditions either of that published version or of any later version
156+
published by the Free Software Foundation. If the Library as you
157+
received it does not specify a version number of the GNU Lesser
158+
General Public License, you may choose any version of the GNU Lesser
159+
General Public License ever published by the Free Software Foundation.
160+
161+
If the Library as you received it specifies that a proxy can decide
162+
whether future versions of the GNU Lesser General Public License shall
163+
apply, that proxy's public statement of acceptance of any version is
164+
permanent authorization for you to choose that version for the
165+
Library.

gallery/MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include LICENSE
2+
include README.rst
3+
recursive-include gallery/static *
4+
recursive-include gallery/templates *

gallery/README.rst

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
.. image:: https://img.shields.io/pypi/v/django-starcross-gallery.svg
2+
:target: https://pypi.python.org/pypi/django-starcross-gallery/
3+
:alt: PyPI version
4+
5+
.. image:: https://travis-ci.org/Starcross/django-starcross-gallery.svg?branch=master
6+
:target: https://travis-ci.org/Starcross/django-starcross-gallery
7+
:alt: Build Status
8+
9+
.. image:: https://coveralls.io/repos/github/Starcross/django-starcross-gallery/badge.svg?branch=master
10+
:target: https://coveralls.io/github/Starcross/django-starcross-gallery?branch=master
11+
:alt: Code coverage
12+
13+
=================
14+
Starcross Gallery
15+
=================
16+
17+
Starcross Gallery is a streamlined photo gallery Django app. Key features are:
18+
19+
* Justified image grid display, as used on sites like Flickr
20+
* Infinite scroll
21+
* Easy drag and drop upload
22+
* Straightforward object model - All metadata is pulled from the file including title and exif data
23+
24+
Demo at https://starcross.dev/gallery
25+
26+
Quick start
27+
-----------
28+
29+
1. Install Starcross gallery using pip::
30+
31+
pip install django-starcross-gallery
32+
33+
2. Add "gallery" to your INSTALLED_APPS setting like this::
34+
35+
INSTALLED_APPS = [
36+
...
37+
'gallery',
38+
]
39+
40+
3. Include the gallery URLconf in your project urls.py like this with your preferred location e.g. "gallery/"::
41+
42+
path('gallery/', include('gallery.urls')),
43+
44+
4. Ensure a `MEDIA directory <https://docs.djangoproject.com/en/2.1/topics/files/>`_ is set up
45+
46+
5. Run ``python manage.py makemigrations gallery``, then ``python manage.py migrate gallery`` to create the models.
47+
48+
6. Start the development server and create any albums you required in http://127.0.0.1:8000/admin/. It's not necessary to create albums if you prefer just a single image feed
49+
50+
7. Visit http://127.0.0.1:8000/gallery/ to access the gallery. Albums can be added through the django admin interface (/admin)
51+
52+
53+
Instructions
54+
------------
55+
56+
Starcross gallery groups Images into Albums, which enables your to organise your presentation. Add albums via the django admin interface, and drag multiple images into your empty albums in the album page itself. It's also possible to use the gallery as a flat image feed only, which is a view published at <gallery base>/images. All images will be displayed here in descending date order. You can add images here directly as well, but they will not be added to an album.
57+
58+
The gallery was designed with simplicity of Image management in mind, so titles are derived from the file name. You only need to add albums and then drag your collection into place. The idea is to avoid the need to manage your collection both on the website and on your disk. If you wish to reorganise, you can delete and easily re-upload
59+
60+
Images in albums are ordered by the date the photo was taken if available in the exif data, or failing that the modification date
61+
62+
Album order can be specified in the Django admin interface. Support for `django-admin-sortable2 <https://github.com/jrief/django-admin-sortable2>`_ is provided, if you want drag and drop ordering in the admin interface. Just installing the module is all that's required. If you have already added albums you will need to use the `reorder <https://django-admin-sortable2.readthedocs.io/en/latest/usage.html#initial-data>`_ command.
63+
64+
Settings
65+
--------
66+
67+
Override these default settings by adding to your settings.py
68+
69+
70+
**GALLERY_LOGO_PATH** -- Default: "gallery/images/starcross.png"
71+
72+
Path to the header logo within the static directory. If you do not wish to use a logo, override with a blank string
73+
74+
**GALLERY_TITLE** -- Default: "Gallery"
75+
76+
The title of the Gallery shown in the header on the main page and image feed
77+
78+
**GALLERY_FOOTER_INFO** -- Default: "Starcross Gallery"
79+
80+
Information text in the footer
81+
82+
**GALLERY_FOOTER_EMAIL** -- Default: "[email protected]"
83+
84+
Contact email address in the footer. Override with a blank string to hide
85+
86+
**GALLERY_THEME_COLOR** -- Default "black"
87+
88+
Use a predefined theme color scheme. Options are black, white, or grey
89+
90+
**GALLERY_THUMBNAIL_SIZE** -- Default: 200
91+
92+
The target thumbnail height in px. This will vary slightly in rendering due to the justified layout
93+
94+
**GALLERY_PREVIEW_SIZE** -- Default: 1000
95+
96+
The preview size in px - width or height, whichever is largest. The rendered image size will depend on the size of the browser window, so this should be set high enough to not cause a deterioration in quality
97+
98+
**GALLERY_RESIZE_QUALITY** -- Default: 80
99+
100+
JPEG quality (0-100) of the preview and thumbnail images
101+
102+
**GALLERY_HDPI_FACTOR** -- Default: 2
103+
104+
The actual preview and thumbnail sizes are multiplied by this number, but rendered according to the quoted value. This enables high dpi displays, such as many mobile devices to show more detail and take advantage of their extra resolution. Some go up to 4x now, so recommended values are 1-4
105+
106+
**GALLERY_IMAGE_MARGIN** -- Default: 6
107+
108+
Margin between thumbnails in px. Some may prefer a less condensed look, so increase this value if your template requires it
109+
110+
111+
Troubleshooting
112+
---------------
113+
114+
**Broken image links after upload**
115+
116+
Check your MEDIA settings. If the media location on disk is changed, you will need to copy the files in the CACHE directory to the new location, or delete and re-upload the broken images
117+
118+
**Errors during upload**
119+
120+
Your server may have a limit on maximum request size (e.g. client_max_body_size for nginx). This needs to be larger than the combined total of all the images your are uploading at once. Also the timeout may need to be extended as preview and thumbnail caches are generated at the time of upload
121+
122+
**Delay when dragging images into upload box**
123+
124+
If you are using Firefox on Linux, there can be a delay before the upload box flashes to acknowledge the pending files, proportional to the number of files. You can use another browser such as Chrome if this is inconvenient.
125+
126+
Credits
127+
-------
128+
129+
Starcross Gallery is by Alex Luton <[email protected]>, published under GNU LGPLv3
130+
131+
132+
Album icon by Google licensed CC BY 3.0
133+
134+
Focal Length icon by Ilaria Bernareggi from the Noun Project
135+
136+
Other image data icons made by Freepik www.flaticon.com licensed by CC 3.0 BY

gallery/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
default_app_config = 'gallery.apps.GalleryConfig'

gallery/admin.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from gallery.models import Image, Album
2+
from django.contrib import admin
3+
from imagekit.admin import AdminThumbnail
4+
# Support adminsortable2 optionally
5+
import importlib
6+
if importlib.util.find_spec('adminsortable2', 'admin'):
7+
from adminsortable2.admin import SortableAdminMixin
8+
else:
9+
# Mock up class for mixin
10+
class SortableAdminMixin:
11+
mock = True
12+
13+
14+
class ImageAdmin(admin.ModelAdmin):
15+
admin_thumbnail = AdminThumbnail(image_field='data_thumbnail', template='gallery/admin/thumbnail.html')
16+
list_display = ('title', 'admin_thumbnail', 'date_taken', 'date_uploaded')
17+
list_filter = ('image_albums',)
18+
list_per_page = 25
19+
readonly_fields = ('admin_thumbnail',)
20+
21+
22+
class AlbumAdmin(SortableAdminMixin, admin.ModelAdmin):
23+
list_display = ('order', 'title')
24+
list_display_links = ('title',)
25+
if hasattr(SortableAdminMixin, 'mock'):
26+
list_editable = ('order',)
27+
list_display = ('title', 'order')
28+
filter_horizontal = ('images',)
29+
raw_id_fields = ('highlight',)
30+
31+
32+
admin.site.register(Image, ImageAdmin)
33+
admin.site.register(Album, AlbumAdmin)
34+

gallery/apps.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django.apps import AppConfig
2+
3+
class GalleryConfig(AppConfig):
4+
name = 'gallery'
5+
verbose_name = 'Starcross Gallery'
6+
7+
def ready(self):
8+
import gallery.signals

0 commit comments

Comments
 (0)