mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-14 12:05:08 +02:00
resize-strategies together with no upscale
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
$version = "v0.7.7* (2015-10-24)";
|
||||
$version = "v0.8.0dev (2015-12-05)";
|
||||
|
||||
|
||||
|
||||
@@ -315,12 +315,9 @@ verbose("referer host = $refererHost");
|
||||
* Get the source files.
|
||||
*/
|
||||
$autoloader = getConfig('autoloader', false);
|
||||
$cimageClass = getConfig('cimage_class', false);
|
||||
|
||||
if ($autoloader) {
|
||||
require $autoloader;
|
||||
} elseif ($cimageClass) {
|
||||
require $cimageClass;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -13,7 +13,8 @@ return array(
|
||||
* Default values:
|
||||
* mode: 'production'
|
||||
*/
|
||||
//'mode' => 'production', // 'development', 'strict'
|
||||
//'mode' => 'production', // 'development', 'strict'
|
||||
'mode' => 'development', // 'development', 'strict'
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +22,9 @@ return array(
|
||||
* Where are the sources for the classfiles.
|
||||
*
|
||||
* Default values:
|
||||
* autoloader: null // used from v0.6.2
|
||||
* cimage_class: null // used until v0.6.1
|
||||
* autoloader: null
|
||||
*/
|
||||
'autoloader' => __DIR__ . '/../autoload.php',
|
||||
//'cimage_class' => __DIR__ . '/../CImage.php',
|
||||
|
||||
|
||||
|
||||
|
@@ -31,7 +31,7 @@ window.CImage = (function() {
|
||||
stack = document.getElementById("stack"),
|
||||
bg = document.getElementById("bg"),
|
||||
permalink = document.getElementById("permalink");
|
||||
|
||||
|
||||
link = "?";
|
||||
link += "input1=" + encodeURIComponent(input1.value) + "&";
|
||||
link += "input2=" + encodeURIComponent(input2.value) + "&";
|
||||
@@ -59,9 +59,9 @@ window.CImage = (function() {
|
||||
button = document.getElementById("button" + id);
|
||||
area = document.getElementById("area" + id);
|
||||
deck = document.getElementById("deck" + id);
|
||||
|
||||
|
||||
updatePermaLink();
|
||||
|
||||
|
||||
if (this.value == "") {
|
||||
// Clear image if input is cleared
|
||||
button.setAttribute("disabled", "disabled");
|
||||
@@ -75,7 +75,7 @@ window.CImage = (function() {
|
||||
area.classList.remove("hidden");
|
||||
|
||||
$.getJSON(this.value + "&json", function(data) {
|
||||
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;
|
||||
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;
|
||||
})
|
||||
.fail(function() {
|
||||
json.innerHTML = "Details not available."
|
||||
@@ -94,7 +94,7 @@ window.CImage = (function() {
|
||||
/**
|
||||
* Init the compare page with details.
|
||||
*/
|
||||
function compareInit(options)
|
||||
function compareInit(options)
|
||||
{
|
||||
var elements, id, onTop, myEvent,
|
||||
input1 = document.getElementById("input1"),
|
||||
@@ -118,7 +118,7 @@ window.CImage = (function() {
|
||||
// Toggle json
|
||||
details.addEventListener("change", function() {
|
||||
var elements = document.querySelectorAll(".json");
|
||||
|
||||
|
||||
forEach(elements, function (index, element) {
|
||||
element.classList.toggle("hidden");
|
||||
});
|
||||
@@ -128,7 +128,7 @@ window.CImage = (function() {
|
||||
element.classList.toggle("hidden");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
updatePermaLink();
|
||||
console.log("View JSON");
|
||||
});
|
||||
@@ -215,7 +215,7 @@ window.CImage = (function() {
|
||||
element.addEventListener("click", function() {
|
||||
var id = this.dataset.id,
|
||||
area = document.getElementById("area" + id);
|
||||
|
||||
|
||||
area.classList.toggle("top");
|
||||
onTop.classList.toggle("top");
|
||||
onTop = area;
|
||||
@@ -239,7 +239,7 @@ window.CImage = (function() {
|
||||
compareLoadImage.call(input6);
|
||||
|
||||
console.log(options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
|
@@ -22,7 +22,8 @@ $images = array(
|
||||
|
||||
|
||||
// For each image, apply these testcases
|
||||
$nc = null; //"&nc"; //null; //&nc';
|
||||
$nc = empty($_SERVER['QUERY_STRING']) ? "" : "&" . $_SERVER['QUERY_STRING'];
|
||||
|
||||
$testcase = array(
|
||||
$nc . '&w=600',
|
||||
$nc . '&w=600&no-upscale',
|
||||
@@ -42,8 +43,8 @@ $testcase = array(
|
||||
$nc . '&w=600&h=200&no-upscale&crop-to-fit',
|
||||
$nc . '&w=300&h=400&crop-to-fit',
|
||||
$nc . '&w=300&h=400&no-upscale&crop-to-fit',
|
||||
$nc . '&w=600&h=400&fill-to-fit',
|
||||
$nc . '&w=600&h=400&no-upscale&fill-to-fit',
|
||||
$nc . '&w=600&h=500&fill-to-fit',
|
||||
$nc . '&w=600&h=500&no-upscale&fill-to-fit',
|
||||
/*
|
||||
$nc . '&w=600&ar=1.6',
|
||||
$nc . '&w=600&ar=1.6&no-upscale',
|
43
webroot/test/resize-landscape.php
Normal file
43
webroot/test/resize-landscape.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// Include config for all testcases
|
||||
include __DIR__ . "/config.php";
|
||||
|
||||
|
||||
|
||||
// The title of the test case
|
||||
$title = "Testing resize landscape image";
|
||||
|
||||
|
||||
|
||||
// Provide a short description of the testcase.
|
||||
$description = "Resize landscape image";
|
||||
|
||||
|
||||
|
||||
// Use these images in the test
|
||||
$images = array(
|
||||
'car.png',
|
||||
);
|
||||
|
||||
|
||||
|
||||
// For each image, apply these testcases
|
||||
$nc = empty($_SERVER['QUERY_STRING']) ? "" : "&" . $_SERVER['QUERY_STRING'];
|
||||
|
||||
$testcase = array(
|
||||
$nc . '&w=500',
|
||||
$nc . '&h=200',
|
||||
$nc . '&w=500&h=500',
|
||||
$nc . '&w=500&h=200',
|
||||
$nc . '&w=500&h=200&crop-to-fit',
|
||||
$nc . '&w=200&h=500&crop-to-fit',
|
||||
$nc . '&w=500&h=200&fill-to-fit',
|
||||
$nc . '&w=200&h=500&fill-to-fit',
|
||||
$nc . '&w=500&h=200&stretch',
|
||||
$nc . '&w=200&h=500&stretch',
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Apply testcases and present results
|
||||
include __DIR__ . "/template.php";
|
43
webroot/test/resize-portrait.php
Normal file
43
webroot/test/resize-portrait.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// Include config for all testcases
|
||||
include __DIR__ . "/config.php";
|
||||
|
||||
|
||||
|
||||
// The title of the test case
|
||||
$title = "Testing resize portrait image";
|
||||
|
||||
|
||||
|
||||
// Provide a short description of the testcase.
|
||||
$description = "Resize portrait image";
|
||||
|
||||
|
||||
|
||||
// Use these images in the test
|
||||
$images = array(
|
||||
'kodim04.png',
|
||||
);
|
||||
|
||||
|
||||
|
||||
// For each image, apply these testcases
|
||||
$nc = empty($_SERVER['QUERY_STRING']) ? "" : "&" . $_SERVER['QUERY_STRING'];
|
||||
|
||||
$testcase = array(
|
||||
$nc . '&w=500',
|
||||
$nc . '&h=200',
|
||||
$nc . '&w=500&h=500',
|
||||
$nc . '&w=500&h=200',
|
||||
$nc . '&w=500&h=200&crop-to-fit',
|
||||
$nc . '&w=200&h=500&crop-to-fit',
|
||||
$nc . '&w=500&h=200&fill-to-fit',
|
||||
$nc . '&w=200&h=500&fill-to-fit',
|
||||
$nc . '&w=500&h=200&stretch',
|
||||
$nc . '&w=200&h=500&stretch',
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Apply testcases and present results
|
||||
include __DIR__ . "/template.php";
|
Reference in New Issue
Block a user