My static photo gallery on GitHub

If you can, do it, please.
I understand that I can upload images in IMG folder, but I don’t understand where I have to past direct link to photos.
Google Drive, or photo, doesn’t provide a direct link by itself, but there some extension that will do it for you

I have spent some minutes searching for that at the beginning, and then immediately gave up the idea… too complex.
The scheme I’m using right now is very simple:

  • I have a “photostore” repository with a gh-pages branch, where I upload my photos. The images are then directly accessible with links like this: https://aferrero2707.github.io/photostore/archive//macro_photography/img00025396-web.jpg
  • for each image, I upload two versions, one with a -web suffix that is in high resolution and one with a -thumb suffix which is 400px in size and is used for thumbnails
  • the web gallery is provided by the gh-pages branch of a second repository, called “photorama” (but you can call it differently if you like). This is a fork of the original photorama repository from sunbliss

The big advantage is that I do not rely on any fancy image storage provider, and I have full control of where the pictures go.

Moreover, I can add pictures in my local copy of the “photostore” repository even if I am offline, and modify the local copy of the web gallery to include the new images.
As soon as I have some internet connection, I can push the changes to github and the new images will be automatically online.

1 Like

Here they say that, even if you have unlimited space, repository should be under 1gb for reasons.
Sure they are still a lot of web compliant photo, but …

I know about the size limitation, however I plan to keep the image size well below 1MB, and I will never have 1000 or more good images to put in my gallery :wink:

Gitlab offers about the same feature: GitLab Pages examples · GitLab

There us a plugin available to generate thumbnails for Jekyll: jekyll-thumbnailer/README.md at master · mrdanadams/jekyll-thumbnailer · GitHub

1 Like

Interesting! I guess one could then move the web gallery from one hosting to the other with little effort.

Newbie question: what could be the advantage of gitlab over github?

Gitlab is free software itself with an enterprise paid version. Github is gratis but not libre.

Thery work very similarly. The good thing about git is you can push the repo lots of places!

1 Like

@Carmelo_DrRaw just because I’m a nut and want a confirmation: do you link manually every single image you upload?

Not really. The static web page for each gallery has a preamble with the list of images to be shown and their corresponding path in the “photostore” repository, like this:

album-folder: "macro_photography"
images:
 - image_name: img00025396
   caption: IMAGE TITLE
   copyright: © Andrea Ferrero
 - image_name: img00025628
   caption: IMAGE TITLE
   copyright: © Andrea Ferrero

and then in the page body there is a loop over the images:

{% for image in page.images %}  		
			<figure class="gallery-item">
				<header class='gallery-icon'>
<a href="{{ site.store_url }}{{ site.store_baseurl }}/{{ page.album-folder }}/{{ image.image_name }}-web.jpg" class="popup"  title="{{ image.caption }}" data-caption="{{ image.copyright }}">
<img src="{{ site.store_url }}{{ site.store_baseurl }}/{{ page.album-folder }}/{{ image.image_name }}-thumb.jpg"></a>
				</header>	
				<figcaption class='gallery-caption'>
					<div class="entry-summary" id="{{ image.caption }}">
						<h3>{{image.caption}}</h3>
						<p>{{image.copyright}}</p>
					</div>
				</figcaption>
			</figure>			
{% endfor %}

Variables like site.store_url are defined globally in _config.yml.

So adding a new image is a mere question of putting the proper file name in the page preamble, which I find super convenient.

1 Like

Thank for your patience :slight_smile:
Ok, now I have just to figure how to assemble all the information you gave me into a functional workflow :joy:

i have never had a git repo and now I have at least 2 of them :joy:

If you have a github account, just fork my photorama repository and the gallery will become automatically accessible as

https://yourusername.github.io/photorama

Then you will need to replace aferrero2707 with your username in _config.yml, and create a second repository for your pictures (unless you want to store then directly in the photorama repository, which is also possible).

It’s what I was thinking of :grin:

It’s working, except for the images link from gphotos :sob:
They worked for a little and then … nothing :disappointed_relieved:

After some digging I found how to link from the other repo (use the https://raw.githubusercontent.com/YOURUSER/YOURREPO/PATH/TO/PHOTO.jpg form)

Now I’ll go for the slider

If you create a gh-pages branch in your “storage” repository as well, the pictures will be accessible through links like

    Yourusername.github.io/storagerepo/path/to/photo.jpg

Which I personally find easier… but at the end, either solution is probably equally reliabl.

1 Like

That could be a possibility, yes.

You should consider making the storage repo a git submodule of your site repo.

But why do you need a storage repo?

Because if anyone wants to fork my photorama repository, then he/she will not import all the pictures as well… apart from that, it doesn’t really matter

1 Like

really nice find ! Thanks for sharing, gotta try it out as well !

Howdy all, I wanted to add a post to this old thread, as I’ve recently come across a great github pages friendly jekyll template for a simple, yet elegant photo portfolio by Ram Petra: https://github.com/ramswaroop/photography.

For me, this template is great because you don’t have to add any markdown code to add new images; you simply add them to the images directory, run the gulp script to resize some thumbs and arrange, and then it works out the tiled arrangement based on the alphabetical order of the image names (no spaces in names, I found out the hard way!). You can add some contact info and bio in the yaml, and you are good to go. Great for someone lazy, like me! :slight_smile: :smile:

Here’s my portfolio rendered with this template: Isaac Ullah, Photography.

2 Likes

that is a really nice template! I’m working on something similar for my site built on hugo. Thanks for sharing!

1 Like