Mappics is a map based travel photos gallery, with automatic place and weather description of the very moment the photos are taken.
It will process all the images placed in a specific directory and perform these operations:
- it fetches Exif data, (https://en.wikipedia.org/wiki/Exif), which usually contain camera model and settings, GPS information, and date and time the photo was taken
- it fetches place description. A short one (like
Goðafoss Waterfalland a long one (likeGoðafoss Waterfall, Goðafossvegur, Öxará, Þingeyjarsveit, Norðurland eystra, Ísland). This is based on the Exif GPS information stored in the photo and obtained from Nominatim and OpenStreetMap APIs - it fetches weather forecast in the place and moment the photo was taken. This is based on the Exif GPS information and the creation date of the photo, and obtained from the DarkSky APIs
- it creates a resized version of the image and a thumbnail, and store them in a different folder from the original one
All these information are shown in galleries and pop up with photos and details, using Leaflet javascript library and Mapbox maps. Frontend is based on Bootstrap framework and backend is written in PHP on top of some Symfony components.
Mappics includes also a backend interface (based on EasyAdminBundle) that lets you modify descriptions, coordinates and creation date of the photos.
You can see a working version here: http://pics.antodippo.com.
Mappics provides a simple console command to process images. To configure and run the command you will have to:
- obtain API keys from external services:
- deploy the application (see dedicated paragraph for details)
- edit your
/.envfile adding the keys from step 1 - place your images in the
<root>/var/galleriesdirectory (Mappics supportsjpgandpngimages), organized in folders (they will become galleries) - run the console command
bin/console mappics:process-galleriesfrom the<root>directory - go to the home page and enjoy your photos!
If you have a lot of images this command can take a long time, so you may want to run it in background:
bin/console mappics:process-galleries &
or, if you want to set-it-and-forget-it and just upload photo every now and then, you could run it as a cron job (it has a lock which prevents multiple execution):
0 * * * * /var/www/mappics/current/bin/console mappics:process-galleries
To access the admin backend you must set the ADMIN_PWD variable in the /.env file, and then access it from www.your-domain.com/mappics-admin.
One option is to make Mappics run on Apache with PHP module. You will have to install and enable the following PHP extensions:
php-curl
php-mbstring
php-zip
php-gd
php-xml
php-exif
You can find a sample virtual host file in /docker/vhost.conf and a Dockerfile to have a better understanting of the system stack needed.
To deploy and update Mappics you can also find a simple configuration for https://deployer.org, in /deploy.sample.php, so you will have to:
- install Deployer
- edit the sample file adding you host information (see comments in file and documentation)
- rename the file in
deploy.php - run
dep deploy(to install the latest version)
If you want to deploy a specific version you can also use the tag option: dep deploy --tag="1.0.0"
Steps to deploy code on production:
- login to production server using credentials using ssh
- move to project directory /var/www/app
- Take pull using git pull command
XAMPP is being used for development purposes download, or you can use any other tool like laragon, it's very easy to setup and use.
Use Herd, or Valet for Mac Os.
Use any tool you are comfortable with, but make sure you have PHP 7.4 or higher installed on your machine.
Make sure you have composer installed on your machine.
- Clone project in
C:/xampp/htdocs/[Whatever directory you have xampp installed] directory. - Clone command: git clone https://github.com/buildvoc/mappics.git (master branch)
- Go inside mappics directory and run composer install command
- Run mappics.sql file in phpmyadmin or using heidisql tool or download
- Open .env file and update your DB connection:
- DATABASE_URL="mysql://root:@localhost:3306/mp_db
- Run this command php -S localhost:8000 -t public/ to start server from root directory.
- run http://localhost/phpmyadmin
- Add a session, then under that session ran the script on test db. and this is how it looks, the columns are added.
- Place your images in the
<root>/var/galleriesdirectory (Mappics supportsjpgandpngimages), organized in folders (they will become galleries). - Place your geojson file in
<root>/var/galleriesdirectory. - run the console command
bin/console mappics:process-galleriesfrom the<root>directory - go to the home page and enjoy your photos!
- To access the admin backend you must set the
ADMIN_PWDvariable in the/.envfile, and then access it fromwww.your-domain.com/admin.
The suggested way to run and work on Mappics in a local enviroment is Docker:
- install Docker on your machine
- clone the repository:
git clone git@github.com:antodippo/mappics.git - build Mappics application:
make setup - run tests:
make test - run application:
make start - browse Mappics on http://localhost:8080
- stop application:
make stop
You should get an empty Mappics home page. To fill it, see the "Usage" paragraph.