|
| 1 | +# Mappics |
| 2 | + |
| 3 | +[](https://travis-ci.org/antodippo/mappics) |
| 4 | +[](https://codecov.io/gh/antodippo/mappics) |
| 5 | + |
| 6 | +Mappics is a **map based** travel photos gallery, with automatic **place** and **weather description** of the very moment the photos are taken. |
| 7 | + |
| 8 | +It will process all the images placed in a specific directory and perform these operations: |
| 9 | + |
| 10 | +- 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 |
| 11 | +- it fetches **place description**. A short one (like `Goðafoss Waterfall` and a long one (like `Goð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](https://nominatim.openstreetmap.org/) |
| 12 | +- 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](https://darksky.net/dev) |
| 13 | +- it creates a **resized version** of the image and a **thumbnail**, and store them in a different folder from the original one |
| 14 | + |
| 15 | +All these information are shown in galleries and pop up with photos and details, using [Leaflet](https://leafletjs.com/) javascript library and [Mapbox](https://www.mapbox.com/) maps. Frontend is based on [Bootstrap](https://getbootstrap.com) framework and backend is written in PHP on top of some [Symfony](https://symfony.com/) components. |
| 16 | + |
| 17 | +You can see a working version here: http://pics.antodippo.com. |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +Mappics provides a simple console command to process images. |
| 22 | +To configure and run the command you will have to: |
| 23 | + |
| 24 | +1. obtain API keys from external services: |
| 25 | + - Dark Sky API: https://darksky.net/dev/register |
| 26 | + - Mapbox: https://account.mapbox.com/auth/signin/?route-to=%22/access-tokens/%22 |
| 27 | +2. deploy the application (see dedicated paragraph for details) |
| 28 | +3. edit your `/.env` file adding the keys from step 1 |
| 29 | +4. place your images in the `<root>/var/galleries` directory (Mappics supports `jpg` and `png` images), organized in folders (they will become galleries) |
| 30 | +5. run the console command `bin/console mappics:process-galleries` from the `<root>` directory |
| 31 | +6. go to the home page and enjoy your photos! |
| 32 | + |
| 33 | +If you have a lot of images this command can take a long time, so you may want to run it in background: |
| 34 | + |
| 35 | +`bin/console mappics:process-galleries &` |
| 36 | + |
| 37 | +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): |
| 38 | + |
| 39 | +`0 * * * * /var/www/mappics/current/bin/console mappics:process-galleries` |
| 40 | + |
| 41 | +## Deploy |
| 42 | + |
| 43 | +One option is to make Mappics run on Apache with PHP module. You will have to install and enable the following PHP extensions: |
| 44 | + |
| 45 | +``` |
| 46 | +php-curl |
| 47 | +php-mbstring |
| 48 | +php-zip |
| 49 | +php-gd |
| 50 | +php-xml |
| 51 | +php-exif |
| 52 | +``` |
| 53 | + |
| 54 | +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. |
| 55 | + |
| 56 | +To deploy and update Mappics you can also find a simple configuration for [https://deployer.org](https://deployer.org), in `/deploy.sample.php`, so you will have to: |
| 57 | + |
| 58 | +1. [install Deployer](https://deployer.org/docs/getting-started.html) |
| 59 | +2. edit the sample file adding you host information (see comments in file and [documentation](https://deployer.org/docs/hosts.html)) |
| 60 | +3. rename the file in `deploy.php` |
| 61 | +4. run `dep deploy` (to install the latest version) |
| 62 | + |
| 63 | +If you want to deploy a specific version you can also use the tag option: `dep deploy --tag="1.0.0"` |
| 64 | + |
| 65 | +## Run on your local machine |
| 66 | + |
| 67 | +The suggested way to run and work on Mappics in a local enviroment is [Docker](https://www.docker.com/): |
| 68 | + |
| 69 | +1. [install Docker](https://www.docker.com/get-started) on your machine |
| 70 | +2. clone the repository: `git clone git@github.com:antodippo/mappics.git` |
| 71 | +3. build Mappics image: `docker-compose build` |
| 72 | +4. run tests: `bin/run-tests` |
| 73 | +5. run application setup: `bin/prepare-application` |
| 74 | +6. run application: `docker-compose up -d` |
| 75 | +7. browse Mappics on http://localhost:8080 |
| 76 | + |
| 77 | +You should get an empty Mappics home page. To fill it, see the "Usage" paragraph. |
0 commit comments