Picserver is a high performance image server (IS) developed with Mantra. This project is expected to be used as it is in its current state or as a starting point to add your specific needs.
image server
Download with:
$ mantrad download-project picserver@1.0.0
Or download last version with:
$ mantrad download-project picserver
Extract project with:
$ tar -xf picserver@1.0.0.tar.gz
Then install:
$ cd picserver
$ mantrad install
README.md
Picserver Mantra seed app
Picserver is an high performance image server (or IMS), with the ability to generate images on-the-fly with differents resolutions: no need to save differente sizes for your images in your project.
As a Mantra application, this project shows a number of the main features of Mantra, like:
- Views and blocks.
- Item templates.
- Middlewares.
- Prerequests and access conditions.
Picserver shows a simple web interface to add or remove pictures. The same application is used to served the images to any other application.
Picserver features
Picserver includes a number of basic but powerful features, described in the following sections.
High number of images to stored and serve
With files Mantra component, images are stored efficiently in local space.
Generation of images with different resolutions on-the-fly
Using swr Mantra component, images can be served with the resolution you need, with urls like this, where this image is served with 120 pixels width:
http://localhost:8080/swr/resize:w(120)/-/509defb78b8e4c84b06422258ad9aba3
Or with 240 pixels width simply modifying the parameter "w":
http://localhost:8080/swr/resize:w(240)/-/509defb78b8e4c84b06422258ad9aba3
File uploader
Picserver includes a simple file uploader to upload your images.
Simple security to upload or remove images
Because Mantra seed or base projects intend to be as starting points of your project needs, no complex login or register functionality is included.
To upload or remove an image, you need to type a simple password: (12345 by default when you install the application).
To change that password, just run the command change-upload-password implemented by "upload" component:
$ mantrad change-upload-password
Adding a bulk of images
The application implements the command upload-images to upload a number of images in one step:
$ mantrad upload-images <directory containing the images>
The images files should be named as "<base>-<tag>.extension", for instance: "027-flowers".
The directory can be relative or abolute.
You can find a number of sample images at /otherstuff/sampleimages folder.
Admin theme based bootstrap
The web interface is based on SB Admin 2 Bootstrap project which can be used for free.
Picserver components
Picserver is an application based on a number of Mantra components.
Some of them can be downloaded from oficial Mantra components repository, others has been developed specifically for this project.
In the following, there's a brief summary of all of them.
You can read more about each component and learn how to use them in README.md file for each of them.
apiextend
Defines a number of useful libraries (like common, underscore, etc.) to be used by any other component by Mantra.Extend API.
csfr
Simple component to generate and validate CSFR token, used by "forms" component.
execcommand
This component runs a bash command programatically. Used by "files" component.
dynamicschema
Allows other components to define dynamic schemas. Used for the tagging mecanism of images.
download
Defines a simple view so that an user can download an image.
files
This component defines an API and a files structure in local drive to store virtually any number of files. Used to store all images uploaded by the application.
footer
Defines a simple block used to show the footer of the web application.
forms
This component allows to generate forms using a JSON description.
generalprops
Defines a simple data model with keys and values. Used by "upload" to store the password to upload or remove images.
imagescategories
Component that simply defines a block showing all images categories currently in the application.
imagesize
This is just a component wrapper for image-size package. Used to get the width and height of the images.
justifiedgallery
This component is a wrapper for justified gallery jquery plugin, developed by Miro Mannino. Thanks Miro!
landing
Defines the view that it is shown as a landing page of the web application.
logos
Component used to allocate all logo images.
mantraapiajax
Used by "forms" component, defines a number of client side javascript method to make AJAX operations.
multilanguage
Simple component to define a number of multilanguage features. Used by other components despite Picserver doesn't support multilanguage in this version.
pager
Defines the functionality to navigate between images page by page. Used by views defined by "upload".
swr
Smart Web Resources is the component used to server images on-the-fly with the resolution requested.
tagging
Complex component that defines dynamic schemas to save images tags or categories efficiently.
taggingvalidator
Defines a validator used by "forms" so that the tags introduced by the user when uploading a new image are right.
tempcache
Defines a temporal memory cache with a key / value mecanism.
upload
This is the main component of Picserver: defines the views to upload new images, remove them and query between them.
workflows
Component that defines workflows, this is, a number of steps defined by forms to perform actions. Used to upload images or remove them.
You found a bug or somthing to fix?
Tell us, please at Mantra support and we'll be happy to read you.
MIT License
Copyright (c) 2022 www.mantrajs.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.