mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-03 22:57:43 +02:00
mergin parts from latest
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
# Tests to be done
|
# Tests to be done
|
||||||
|
|
||||||
Use resize fill-to-fit, crop-to-fit, stretch without width and height should result in image having original width and height.
|
Use resize fill-to-fit, crop-to-fit, stretch without width and height should result in image having original width and height.
|
||||||
|
|
||||||
|
## Integration tests
|
||||||
|
|
||||||
|
Checkout a version using composer and execute all tests, prefarably on cimage.se.
|
||||||
|
BIN
webroot/img/apple.jpg
Normal file
BIN
webroot/img/apple.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@@ -10,6 +10,15 @@ return [
|
|||||||
/**
|
/**
|
||||||
* Set mode as 'strict', 'production' or 'development'.
|
* Set mode as 'strict', 'production' or 'development'.
|
||||||
*
|
*
|
||||||
|
* development: Development mode with verbose error reporting. Option
|
||||||
|
* &verbose and &status enabled.
|
||||||
|
* production: Production mode logs all errors to file, giving server
|
||||||
|
* error 500 for bad usage. Option &verbose and &status
|
||||||
|
* disabled.
|
||||||
|
* strict: Strict mode logs few errors to file, giving server error
|
||||||
|
* 500 for bad usage. Stripped from comments and spaces.
|
||||||
|
* Option &verbose and &status disabled.
|
||||||
|
*
|
||||||
* Default values:
|
* Default values:
|
||||||
* mode: 'production'
|
* mode: 'production'
|
||||||
*/
|
*/
|
||||||
@@ -106,6 +115,20 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use backup image if src-image is not found on disk. The backup image
|
||||||
|
* is only available for local images and based on wether the original
|
||||||
|
* image is found on disk or not. The backup image must be a local image
|
||||||
|
* or the dummy image.
|
||||||
|
*
|
||||||
|
* Default value:
|
||||||
|
* src_alt: null //disabled by default
|
||||||
|
*/
|
||||||
|
//'src_alt' => 'car.png',
|
||||||
|
//'src_alt' => 'dummy',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A regexp for validating characters in the image or alias filename.
|
* A regexp for validating characters in the image or alias filename.
|
||||||
*
|
*
|
||||||
@@ -123,18 +146,20 @@ return [
|
|||||||
* when saving images.
|
* when saving images.
|
||||||
*
|
*
|
||||||
* Default value:
|
* Default value:
|
||||||
* jpg_quality: null, integer between 0-100
|
* jpg_quality: null, integer between 0-100,
|
||||||
* png_compression: null, integer between 0-9
|
* default is 60
|
||||||
|
* png_compression: null, integer between 0-9,
|
||||||
|
* default is -1 (PHP GD decides)
|
||||||
*/
|
*/
|
||||||
//'jpg_quality' => 75,
|
//'jpg_quality' => 60,
|
||||||
//'png_compression' => 1,
|
//'png_compression' => -1,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the image to srgb before processing. Saves the converted
|
* Convert the image to sRGB before processing. Saves the converted
|
||||||
* image in a cache subdir 'srgb'. This option is default false but can
|
* image in a cache subdir 'srgb'. This option is default false but can
|
||||||
* be changed to default true to do this conversion for all images.
|
* be changed to default true to always do conversion for all images.
|
||||||
* This option requires PHP extension imagick and will silently fail
|
* This option requires PHP extension imagick and will silently fail
|
||||||
* if that is not installed.
|
* if that is not installed.
|
||||||
*
|
*
|
||||||
@@ -273,7 +298,7 @@ return [
|
|||||||
* jpeg_optimize_cmd: '/usr/local/bin/jpegtran -copy none -optimize'
|
* jpeg_optimize_cmd: '/usr/local/bin/jpegtran -copy none -optimize'
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
'postprocessing' => array(
|
'postprocessing' => [
|
||||||
'png_filter' => false,
|
'png_filter' => false,
|
||||||
'png_filter_cmd' => '/usr/local/bin/optipng -q',
|
'png_filter_cmd' => '/usr/local/bin/optipng -q',
|
||||||
|
|
||||||
@@ -282,7 +307,7 @@ return [
|
|||||||
|
|
||||||
'jpeg_optimize' => false,
|
'jpeg_optimize' => false,
|
||||||
'jpeg_optimize_cmd' => '/usr/local/bin/jpegtran -copy none -optimize',
|
'jpeg_optimize_cmd' => '/usr/local/bin/jpegtran -copy none -optimize',
|
||||||
),
|
],
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -399,7 +424,7 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default options for ascii image.
|
* Default options for ascii image.
|
||||||
*
|
*
|
||||||
* Default values as specified below in the array.
|
* Default values as specified below in the array.
|
||||||
* ascii-options:
|
* ascii-options:
|
||||||
|
@@ -31,7 +31,7 @@ window.CImage = (function() {
|
|||||||
stack = document.getElementById("stack"),
|
stack = document.getElementById("stack"),
|
||||||
bg = document.getElementById("bg"),
|
bg = document.getElementById("bg"),
|
||||||
permalink = document.getElementById("permalink");
|
permalink = document.getElementById("permalink");
|
||||||
|
|
||||||
link = "?";
|
link = "?";
|
||||||
link += "input1=" + encodeURIComponent(input1.value) + "&";
|
link += "input1=" + encodeURIComponent(input1.value) + "&";
|
||||||
link += "input2=" + encodeURIComponent(input2.value) + "&";
|
link += "input2=" + encodeURIComponent(input2.value) + "&";
|
||||||
@@ -59,9 +59,9 @@ window.CImage = (function() {
|
|||||||
button = document.getElementById("button" + id);
|
button = document.getElementById("button" + id);
|
||||||
area = document.getElementById("area" + id);
|
area = document.getElementById("area" + id);
|
||||||
deck = document.getElementById("deck" + id);
|
deck = document.getElementById("deck" + id);
|
||||||
|
|
||||||
updatePermaLink();
|
updatePermaLink();
|
||||||
|
|
||||||
if (this.value == "") {
|
if (this.value == "") {
|
||||||
// Clear image if input is cleared
|
// Clear image if input is cleared
|
||||||
button.setAttribute("disabled", "disabled");
|
button.setAttribute("disabled", "disabled");
|
||||||
@@ -75,7 +75,7 @@ window.CImage = (function() {
|
|||||||
area.classList.remove("hidden");
|
area.classList.remove("hidden");
|
||||||
|
|
||||||
$.getJSON(this.value + "&json", function(data) {
|
$.getJSON(this.value + "&json", function(data) {
|
||||||
json.innerHTML = "filename: " + data.filename + "\ncolors: " + data.colors + "\nsize: " + data.size + "\nwidth: " + data.width + "\nheight: " + data.height + "\naspect-ratio: " + data.aspectRatio + "\npng-type: " + data.pngType;
|
json.innerHTML = "filename: " + data.filename + "\ncolors: " + data.colors + "\nsize: " + data.size + "\nwidth: " + data.width + "\nheigh: " + data.height + "\naspect-ratio: " + data.aspectRatio + "\npng-type: " + data.pngType;
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
json.innerHTML = "Details not available."
|
json.innerHTML = "Details not available."
|
||||||
@@ -94,7 +94,7 @@ window.CImage = (function() {
|
|||||||
/**
|
/**
|
||||||
* Init the compare page with details.
|
* Init the compare page with details.
|
||||||
*/
|
*/
|
||||||
function compareInit(options)
|
function compareInit(options)
|
||||||
{
|
{
|
||||||
var elements, id, onTop, myEvent,
|
var elements, id, onTop, myEvent,
|
||||||
input1 = document.getElementById("input1"),
|
input1 = document.getElementById("input1"),
|
||||||
@@ -118,7 +118,7 @@ window.CImage = (function() {
|
|||||||
// Toggle json
|
// Toggle json
|
||||||
details.addEventListener("change", function() {
|
details.addEventListener("change", function() {
|
||||||
var elements = document.querySelectorAll(".json");
|
var elements = document.querySelectorAll(".json");
|
||||||
|
|
||||||
forEach(elements, function (index, element) {
|
forEach(elements, function (index, element) {
|
||||||
element.classList.toggle("hidden");
|
element.classList.toggle("hidden");
|
||||||
});
|
});
|
||||||
@@ -128,7 +128,7 @@ window.CImage = (function() {
|
|||||||
element.classList.toggle("hidden");
|
element.classList.toggle("hidden");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
updatePermaLink();
|
updatePermaLink();
|
||||||
console.log("View JSON");
|
console.log("View JSON");
|
||||||
});
|
});
|
||||||
@@ -215,7 +215,7 @@ window.CImage = (function() {
|
|||||||
element.addEventListener("click", function() {
|
element.addEventListener("click", function() {
|
||||||
var id = this.dataset.id,
|
var id = this.dataset.id,
|
||||||
area = document.getElementById("area" + id);
|
area = document.getElementById("area" + id);
|
||||||
|
|
||||||
area.classList.toggle("top");
|
area.classList.toggle("top");
|
||||||
onTop.classList.toggle("top");
|
onTop.classList.toggle("top");
|
||||||
onTop = area;
|
onTop = area;
|
||||||
@@ -239,7 +239,7 @@ window.CImage = (function() {
|
|||||||
compareLoadImage.call(input6);
|
compareLoadImage.call(input6);
|
||||||
|
|
||||||
console.log(options);
|
console.log(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user