mirror of
https://github.com/mosbth/cimage.git
synced 2025-01-17 02:58:15 +01:00
fixed markdown syntax
added spaces so the markdown gets parsed correctly
This commit is contained in:
parent
cd142c5880
commit
ac16343cd7
56
README.md
56
README.md
@ -45,7 +45,7 @@ There are several ways of installing. You either install the whole project which
|
||||
|
||||
|
||||
|
||||
###Install source from GitHub
|
||||
### Install source from GitHub
|
||||
|
||||
The [sourcode is available on GitHub](https://github.com/mosbth/cimage). Clone, fork or [download as zip](https://github.com/mosbth/cimage/archive/master.zip).
|
||||
|
||||
@ -66,7 +66,7 @@ chmod 777 cache
|
||||
```
|
||||
|
||||
|
||||
###Install all-included bundle
|
||||
### Install all-included bundle
|
||||
|
||||
There are some all-included bundles of `img.php` that can be downloaded and used without dependency to the rest of the sourcecode.
|
||||
|
||||
@ -86,7 +86,7 @@ Open up the file in your editor and edit the array `$config`. Ensure that the pa
|
||||
|
||||
|
||||
|
||||
###Install from Packagist
|
||||
### Install from Packagist
|
||||
|
||||
You can install the package [`mos/cimage` from Packagist](https://packagist.org/packages/mos/cimage) using composer.
|
||||
|
||||
@ -139,13 +139,13 @@ Get going quickly
|
||||
|
||||
|
||||
|
||||
###Check out the test page
|
||||
### Check out the test page
|
||||
|
||||
Try it out by pointing your browser to the test file `webroot/test/test.php`. It will show some example images and you can review how they are created.
|
||||
|
||||
|
||||
|
||||
###Process your first image
|
||||
### Process your first image
|
||||
|
||||
<img src="https://cimage.se/cimage/imgd.php?src=example/kodim04.png&w=w2&a=40,0,50,0" alt=''>
|
||||
|
||||
@ -159,20 +159,20 @@ and try to resize it to a thumbnail by adding the options
|
||||
|
||||
|
||||
|
||||
###What does "processing the image" involves?
|
||||
### What does "processing the image" involves?
|
||||
|
||||
Add `&verbose` to the link to get a verbose output of what is happens during image processing. This is useful for developers and those who seek a deeper understanding on how it works behind the scene.
|
||||
|
||||
|
||||
|
||||
###Check your system
|
||||
### Check your system
|
||||
|
||||
Open up `webroot/check_system.php` if you are uncertain that your system has the right extensions loaded.
|
||||
|
||||
|
||||
|
||||
|
||||
###How does it work?
|
||||
### How does it work?
|
||||
|
||||
Review the settings in `webroot/img_config.php` and check out `webroot/img.php` on how it uses `CImage`.
|
||||
|
||||
@ -193,7 +193,7 @@ Basic usage
|
||||
|
||||
|
||||
|
||||
###Select the source
|
||||
### Select the source
|
||||
|
||||
Open an image through `img.php` by using its `src` attribute.
|
||||
|
||||
@ -209,7 +209,7 @@ All images are stored in a directory structure and you access them as:
|
||||
|
||||
|
||||
|
||||
###Resize using constraints on width and height
|
||||
### Resize using constraints on width and height
|
||||
|
||||
Create a thumbnail of the image by applying constraints on width and height, or one of them.
|
||||
|
||||
@ -223,7 +223,7 @@ Think of the constraints as a imaginary box where the image should fit. With `wi
|
||||
|
||||
|
||||
|
||||
###Resize to fit a certain dimension
|
||||
### Resize to fit a certain dimension
|
||||
|
||||
Creating a thumbnail with a certain dimension of width and height, usually involves stretching or cropping the image to fit in the selected dimensions. Here is how you create a image that has the exact dimensions of 300x150 pixels, by either *stretching*, *cropping* or *fill to fit*.
|
||||
|
||||
@ -243,7 +243,7 @@ Fill to fit is useful when you have some image that must fit in a certain dimens
|
||||
|
||||
|
||||
|
||||
###List of parameters
|
||||
### List of parameters
|
||||
|
||||
`img.php` supports a lot of parameters. Combine the parameters to get the desired behavior and resulting image. For example, take the original image, resize it using width, aspect-ratio and crop-to-fit, apply a sharpen effect, save the image as JPEG using quality 30.
|
||||
|
||||
@ -255,7 +255,7 @@ Fill to fit is useful when you have some image that must fit in a certain dimens
|
||||
Here is a list of all parameters that you can use together with `img.php`, grouped by its basic intent of usage.
|
||||
|
||||
|
||||
####Mandatory options and debugging
|
||||
#### Mandatory options and debugging
|
||||
|
||||
Option `src` is the only mandatory option. The options in this section is useful for debugging or deciding what version of the target image is used.
|
||||
|
||||
@ -270,7 +270,7 @@ Option `src` is the only mandatory option. The options in this section is useful
|
||||
|
||||
|
||||
|
||||
####Options for deciding width and height of target image
|
||||
#### Options for deciding width and height of target image
|
||||
|
||||
These options are all affecting the final dimensions, width and height, of the resulting image.
|
||||
|
||||
@ -283,7 +283,7 @@ These options are all affecting the final dimensions, width and height, of the r
|
||||
|
||||
|
||||
|
||||
####Options for resize strategy
|
||||
#### Options for resize strategy
|
||||
|
||||
These options affect strategy to use when resizing an image into a target image that has both width and height set.
|
||||
|
||||
@ -296,7 +296,7 @@ These options affect strategy to use when resizing an image into a target image
|
||||
|
||||
|
||||
|
||||
####Options for cropping part of image
|
||||
#### Options for cropping part of image
|
||||
|
||||
These options enable to decide what part of image to crop out.
|
||||
|
||||
@ -307,7 +307,7 @@ These options enable to decide what part of image to crop out.
|
||||
|
||||
|
||||
|
||||
####General processing options
|
||||
#### General processing options
|
||||
|
||||
These options are general options affecting processing.
|
||||
|
||||
@ -317,7 +317,7 @@ These options are general options affecting processing.
|
||||
|
||||
|
||||
|
||||
####Processing of image before resizing
|
||||
#### Processing of image before resizing
|
||||
|
||||
This option are executed *before* the image is resized.
|
||||
|
||||
@ -329,7 +329,7 @@ This option are executed *before* the image is resized.
|
||||
|
||||
|
||||
|
||||
####Processing of image after resizing
|
||||
#### Processing of image after resizing
|
||||
|
||||
These options are executed *after* the image is resized.
|
||||
|
||||
@ -347,7 +347,7 @@ These options are executed *after* the image is resized.
|
||||
|
||||
|
||||
|
||||
####Saving image, affecting quality and file size
|
||||
#### Saving image, affecting quality and file size
|
||||
|
||||
Options for saving the target image.
|
||||
|
||||
@ -403,7 +403,7 @@ Consult the file `webroot/img-config.php` for a complete list together with the
|
||||
|
||||
|
||||
|
||||
###Create and name the config file
|
||||
### Create and name the config file
|
||||
|
||||
The file `img.php` looks for the config-file `img_config.php`, and uses it if its found. The three files where everything is included -- `imgd.php`, `imgp.php` and `imgs.php` -- includes an empty `$config`-array which can be overridden by saving a config-file in the same directory. If the script is `imgp.php` then name the config-file `imgp_config.php` and it will find it and use those settings.
|
||||
|
||||
@ -468,19 +468,19 @@ Here are some thoughts when applying `img.php` on a live system.
|
||||
|
||||
|
||||
|
||||
###Select the proper mode
|
||||
### Select the proper mode
|
||||
|
||||
Select the proper mode for `img.php`. Set it to "strict" or "production" to prevent outsiders to get information about your system. Use only "development" for internal use since its quite verbose in its nature of error reporting.
|
||||
|
||||
|
||||
|
||||
###Put the installation directory outside web root
|
||||
### Put the installation directory outside web root
|
||||
|
||||
Edit the config file to put the installation directory -- and the cache directory -- outside of the web root. Best practice would be to store the installation directory and cache, outside of the web root. The only thing needed in the web root is `img.php` and `img_config.php` (if used) which can be placed, for example, in `/img/img.php` or just as `/img.php`.
|
||||
|
||||
|
||||
|
||||
###Friendly urls through `.htaccess`
|
||||
### Friendly urls through `.htaccess`
|
||||
|
||||
Use `.htaccess`and rewrite rules (Apache) to get friendly image urls. Put `img.php` in the `/img` directory. Put the file `.htaccess` in the web root.
|
||||
|
||||
@ -518,7 +518,7 @@ The result is good readable urls to your images. Its easy for the search engine
|
||||
|
||||
|
||||
|
||||
###Monitor cache size
|
||||
### Monitor cache size
|
||||
|
||||
There is a utility `cache.bash` included for monitoring the size of the cache-directory. It generates an output like this.
|
||||
|
||||
@ -556,13 +556,13 @@ Use it as a base if you feel the need to monitor the size och the cache-director
|
||||
|
||||
|
||||
|
||||
###Read-only cache
|
||||
### Read-only cache
|
||||
|
||||
The cache directory need to be writable for `img.php` to create new files. But its possible to first create all cache-files and then set the directory to be read-only. This will give you a way of shutting of `img.php` from creating new cache files. `img.php` will then continue to work for all images having a cached version but will fail if someone tries to create a new, not previously cached, version of the image.
|
||||
|
||||
|
||||
|
||||
###Post-processing with external tools
|
||||
### Post-processing with external tools
|
||||
|
||||
You can use external tools to post-process the images to optimize the file size. This option is available for JPEG and for PNG images. Post-processing is disabled by default, edit `img_config.php` to enable it.
|
||||
|
||||
@ -572,7 +572,7 @@ These tools for post processing is not a part of `CImage` and `img.php`, you nee
|
||||
|
||||
|
||||
|
||||
###Allowing remote download of images
|
||||
### Allowing remote download of images
|
||||
|
||||
You can allow `img.php` to download remote images. That can be enabled in the config-file. However, before doing so, consider the implications on allowing anyone to download a file, hopefully an image, to your server and then the possibility to access it through the webserver.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user