Added 9 new (instagram like) filters. Closes #3
10
README.md
Normal file → Executable file
@@ -6,6 +6,7 @@ PictShare is an multi lingual, open source image hosting service with a simple r
|
|||||||
|
|
||||||
UPDATES
|
UPDATES
|
||||||
========
|
========
|
||||||
|
- Nov. 07: Added 9 new (instagram-like) filters
|
||||||
- Nov. 06: Master delete code. One code to delete them all
|
- Nov. 06: Master delete code. One code to delete them all
|
||||||
- Nov. 01: [Restricted uploads and option-use](#restriction-settings)
|
- Nov. 01: [Restricted uploads and option-use](#restriction-settings)
|
||||||
- Oct. 30: [Rotations and filters](#smart-query-system)
|
- Oct. 30: [Rotations and filters](#smart-query-system)
|
||||||
@@ -58,6 +59,15 @@ smooth | -10 to 2048 | https://pictshare.net/smooth_3/b260e36b60
|
|||||||
contrast | -100 to 100 | https://pictshare.net/contrast_40/b260e36b60.jpg | 
|
contrast | -100 to 100 | https://pictshare.net/contrast_40/b260e36b60.jpg | 
|
||||||
pixelate | 0 to 100 | https://pictshare.net/pixelate_10/b260e36b60.jpg | 
|
pixelate | 0 to 100 | https://pictshare.net/pixelate_10/b260e36b60.jpg | 
|
||||||
blur | -none- or 0 to 5 | https://pictshare.net/blur/b260e36b60.jpg | 
|
blur | -none- or 0 to 5 | https://pictshare.net/blur/b260e36b60.jpg | 
|
||||||
|
sepia | -none- | https://pictshare.net/sepia/b260e36b60.jpg | 
|
||||||
|
sharpen | -none- | https://pictshare.net/sharpen/b260e36b60.jpg | 
|
||||||
|
emboss | -none- | https://pictshare.net/emboss/b260e36b60.jpg | 
|
||||||
|
cool | -none- | https://pictshare.net/cool/b260e36b60.jpg | 
|
||||||
|
light | -none- | https://pictshare.net/light/b260e36b60.jpg | 
|
||||||
|
aqua | -none- | https://pictshare.net/aqua/b260e36b60.jpg | 
|
||||||
|
fuzzy | -none- | https://pictshare.net/fuzzy/b260e36b60.jpg | 
|
||||||
|
boost | -none- | https://pictshare.net/boost/b260e36b60.jpg | 
|
||||||
|
gray | -none- | https://pictshare.net/gray/b260e36b60.jpg | 
|
||||||
|
|
||||||
You can also combine as many options as you want. Even multiple times! Want your image to be negative, resized, grayscale , with increased brightness and negate it again? No problem: https://pictshare.net/500x500/grayscale/negative/brightness_100/negative/b260e36b60.jpg
|
You can also combine as many options as you want. Even multiple times! Want your image to be negative, resized, grayscale , with increased brightness and negate it again? No problem: https://pictshare.net/500x500/grayscale/negative/brightness_100/negative/b260e36b60.jpg
|
||||||
|
|
||||||
|
|||||||
0
backend.php
Normal file → Executable file
220
classes/filter.php
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Filter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var resource
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directory for image assets.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
|
||||||
|
private $assetDirectory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* run constructor
|
||||||
|
* @param resource &$image GD image resource
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function __construct(&$image)
|
||||||
|
{
|
||||||
|
$this->image = $image;
|
||||||
|
|
||||||
|
$this->assetDirectory = dirname(dirname(dirname(__FILE__))) . '/assets/';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current image resource
|
||||||
|
*
|
||||||
|
* @return resource
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getImage()
|
||||||
|
{
|
||||||
|
return $this->image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bubbles()
|
||||||
|
{
|
||||||
|
$dest = imagecreatefromjpeg($this->assetDirectory . "pattern4.jpg");
|
||||||
|
|
||||||
|
$x = imagesx($this->image);
|
||||||
|
$y = imagesy($this->image);
|
||||||
|
|
||||||
|
$x2 = imagesx($dest);
|
||||||
|
$y2 = imagesy($dest);
|
||||||
|
|
||||||
|
$thumb = imagecreatetruecolor($x, $y);
|
||||||
|
imagecopyresampled($thumb, $dest, 0, 0, 0, 0, $x, $y, $x2, $y2);
|
||||||
|
|
||||||
|
imagecopymerge($this->image, $thumb, 0, 0, 0, 0, $x, $y, 20);
|
||||||
|
imagefilter($this->image, IMG_FILTER_BRIGHTNESS, 40);
|
||||||
|
imagefilter($this->image, IMG_FILTER_CONTRAST, -10);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function colorise()
|
||||||
|
{
|
||||||
|
$dest = imagecreatefromjpeg($this->assetDirectory . "pattern5.jpg");
|
||||||
|
|
||||||
|
$x = imagesx($this->image);
|
||||||
|
$y = imagesy($this->image);
|
||||||
|
|
||||||
|
$x2 = imagesx($dest);
|
||||||
|
$y2 = imagesy($dest);
|
||||||
|
|
||||||
|
$thumb = imagecreatetruecolor($x, $y);
|
||||||
|
imagecopyresampled($thumb, $dest, 0, 0, 0, 0, $x, $y, $x2, $y2);
|
||||||
|
|
||||||
|
imagecopymerge($this->image, $thumb, 0, 0, 0, 0, $x, $y, 40);
|
||||||
|
imagefilter($this->image, IMG_FILTER_CONTRAST, -25);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sepia()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
||||||
|
imagefilter($this->image, IMG_FILTER_COLORIZE, 100, 50, 0);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sharpen()
|
||||||
|
{
|
||||||
|
$gaussian = array(
|
||||||
|
array(1.0, 1.0, 1.0),
|
||||||
|
array(1.0, -7.0, 1.0),
|
||||||
|
array(1.0, 1.0, 1.0)
|
||||||
|
);
|
||||||
|
imageconvolution($this->image, $gaussian, 1, 4);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function emboss()
|
||||||
|
{
|
||||||
|
$gaussian = array(
|
||||||
|
array(-2.0, -1.0, 0.0),
|
||||||
|
array(-1.0, 1.0, 1.0),
|
||||||
|
array(0.0, 1.0, 2.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
imageconvolution($this->image, $gaussian, 1, 5);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cool()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_MEAN_REMOVAL);
|
||||||
|
imagefilter($this->image, IMG_FILTER_CONTRAST, -50);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function old2()
|
||||||
|
{
|
||||||
|
$dest = imagecreatefromjpeg($this->assetDirectory . "pattern1.jpg");
|
||||||
|
|
||||||
|
$x = imagesx($this->image);
|
||||||
|
$y = imagesy($this->image);
|
||||||
|
|
||||||
|
$x2 = imagesx($dest);
|
||||||
|
$y2 = imagesy($dest);
|
||||||
|
|
||||||
|
$thumb = imagecreatetruecolor($x, $y);
|
||||||
|
imagecopyresampled($thumb, $dest, 0, 0, 0, 0, $x, $y, $x2, $y2);
|
||||||
|
|
||||||
|
imagecopymerge($this->image, $thumb, 0, 0, 0, 0, $x, $y, 40);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function old3()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_CONTRAST, -30);
|
||||||
|
|
||||||
|
$dest = imagecreatefromjpeg($this->assetDirectory . "pattern3.jpg");
|
||||||
|
|
||||||
|
$x = imagesx($this->image);
|
||||||
|
$y = imagesy($this->image);
|
||||||
|
|
||||||
|
$x2 = imagesx($dest);
|
||||||
|
$y2 = imagesy($dest);
|
||||||
|
|
||||||
|
$thumb = imagecreatetruecolor($x, $y);
|
||||||
|
imagecopyresampled($thumb, $dest, 0, 0, 0, 0, $x, $y, $x2, $y2);
|
||||||
|
|
||||||
|
imagecopymerge($this->image, $thumb, 0, 0, 0, 0, $x, $y, 50);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function old()
|
||||||
|
{
|
||||||
|
$dest = imagecreatefromjpeg($this->assetDirectory . "bg1.jpg");
|
||||||
|
|
||||||
|
$x = imagesx($this->image);
|
||||||
|
$y = imagesy($this->image);
|
||||||
|
|
||||||
|
$x2 = imagesx($dest);
|
||||||
|
$y2 = imagesy($dest);
|
||||||
|
|
||||||
|
$thumb = imagecreatetruecolor($x, $y);
|
||||||
|
imagecopyresampled($thumb, $dest, 0, 0, 0, 0, $x, $y, $x2, $y2);
|
||||||
|
|
||||||
|
imagecopymerge($this->image, $thumb, 0, 0, 0, 0, $x, $y, 30);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function light()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_BRIGHTNESS, 10);
|
||||||
|
imagefilter($this->image, IMG_FILTER_COLORIZE, 100, 50, 0, 10);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function aqua()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_COLORIZE, 0, 70, 0, 30);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fuzzy()
|
||||||
|
{
|
||||||
|
$gaussian = array(
|
||||||
|
array(1.0, 1.0, 1.0),
|
||||||
|
array(1.0, 1.0, 1.0),
|
||||||
|
array(1.0, 1.0, 1.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
imageconvolution($this->image, $gaussian, 9, 20);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function boost()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_CONTRAST, -35);
|
||||||
|
imagefilter($this->image, IMG_FILTER_BRIGHTNESS, 10);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function gray()
|
||||||
|
{
|
||||||
|
imagefilter($this->image, IMG_FILTER_CONTRAST, -60);
|
||||||
|
imagefilter($this->image, IMG_FILTER_GRAYSCALE);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
0
classes/html.php
Normal file → Executable file
9
classes/image.php
Normal file → Executable file
@@ -205,6 +205,15 @@ class Image
|
|||||||
case 'contrast': imagefilter($im,IMG_FILTER_CONTRAST,$val); break;
|
case 'contrast': imagefilter($im,IMG_FILTER_CONTRAST,$val); break;
|
||||||
case 'pixelate': imagefilter($im,IMG_FILTER_PIXELATE,$val); break;
|
case 'pixelate': imagefilter($im,IMG_FILTER_PIXELATE,$val); break;
|
||||||
case 'blur': $this->blur($im,$val); break;
|
case 'blur': $this->blur($im,$val); break;
|
||||||
|
case 'sepia': (new Filter($im))->sepia()->getImage();break;
|
||||||
|
case 'sharpen':(new Filter($im))->sharpen()->getImage();break;
|
||||||
|
case 'emboss':(new Filter($im))->emboss()->getImage();break;
|
||||||
|
case 'cool':(new Filter($im))->cool()->getImage();break;
|
||||||
|
case 'light':(new Filter($im))->light()->getImage();break;
|
||||||
|
case 'aqua':(new Filter($im))->aqua()->getImage();break;
|
||||||
|
case 'fuzzy':(new Filter($im))->fuzzy()->getImage();break;
|
||||||
|
case 'boost':(new Filter($im))->boost()->getImage();break;
|
||||||
|
case 'gray':(new Filter($im))->gray()->getImage();break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
classes/model.php
Normal file → Executable file
0
css/imgs/Thumbs.db
Normal file → Executable file
0
css/imgs/bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
0
css/imgs/content.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
css/imgs/deleted.jpg
Normal file → Executable file
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
0
css/imgs/footer.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
0
css/imgs/header.png
Normal file → Executable file
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
0
css/imgs/header_empty.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
0
css/imgs/header_logo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
0
css/imgs/hs_logo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
0
css/main.css
Normal file → Executable file
0
css/normalize.css
vendored
Normal file → Executable file
0
css/pictshare.css
Normal file → Executable file
0
inc/.gitignore
vendored
Normal file → Executable file
0
inc/core.php
Normal file → Executable file
100
inc/example.config.inc.php
Normal file → Executable file
@@ -1,51 +1,51 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//If set, can be added to any image URL to delete the image and all versions of the image
|
//If set, can be added to any image URL to delete the image and all versions of the image
|
||||||
//Must be longer than 10 characters
|
//Must be longer than 10 characters
|
||||||
//Usage example:
|
//Usage example:
|
||||||
// image: https://pictshare.net/b260e36b60.jpg
|
// image: https://pictshare.net/b260e36b60.jpg
|
||||||
// to delete it, access https://pictshare.net/delete_YOURMASTERDELETECODE/b260e36b60.jpg
|
// to delete it, access https://pictshare.net/delete_YOURMASTERDELETECODE/b260e36b60.jpg
|
||||||
// Will render one last time, if refreshed won't be on the server anymore
|
// Will render one last time, if refreshed won't be on the server anymore
|
||||||
define('MASTER_DELETE_CODE', false);
|
define('MASTER_DELETE_CODE', false);
|
||||||
|
|
||||||
//If set, upload form will only be shown on that location
|
//If set, upload form will only be shown on that location
|
||||||
//eg: define('UPLOAD_FORM_LOCATION', 'secret/upload'); then the upload form will only be visible
|
//eg: define('UPLOAD_FORM_LOCATION', 'secret/upload'); then the upload form will only be visible
|
||||||
//from http://your.domain/secret/upload
|
//from http://your.domain/secret/upload
|
||||||
define('UPLOAD_FORM_LOCATION', false);
|
define('UPLOAD_FORM_LOCATION', false);
|
||||||
|
|
||||||
//If set to true, the only page that will be rendered is the upload form
|
//If set to true, the only page that will be rendered is the upload form
|
||||||
//if a wrong link is provided, 404 will be shown instead of the error page
|
//if a wrong link is provided, 404 will be shown instead of the error page
|
||||||
//It's meant to be used to hide the fact that you're using pictshare and your site just looks like a content server
|
//It's meant to be used to hide the fact that you're using pictshare and your site just looks like a content server
|
||||||
//use in combination with UPLOAD_FORM_LOCATION for maximum sneakiness
|
//use in combination with UPLOAD_FORM_LOCATION for maximum sneakiness
|
||||||
define('LOW_PROFILE', false);
|
define('LOW_PROFILE', false);
|
||||||
|
|
||||||
//if set to a string, this string must be provided before upload.
|
//if set to a string, this string must be provided before upload.
|
||||||
//you can set multiple codes by;separating;them;with;semicolons
|
//you can set multiple codes by;separating;them;with;semicolons
|
||||||
//if set to false, everybody can upload
|
//if set to false, everybody can upload
|
||||||
//for API uploads, the GET Variable 'upload_code' must be provided
|
//for API uploads, the GET Variable 'upload_code' must be provided
|
||||||
define('UPLOAD_CODE', false);
|
define('UPLOAD_CODE', false);
|
||||||
|
|
||||||
//if set to a string, this string must be provided in the URL to use any options (filters, resizes, etc..)
|
//if set to a string, this string must be provided in the URL to use any options (filters, resizes, etc..)
|
||||||
//you can set multiple codes by;separating;them;with;semicolons
|
//you can set multiple codes by;separating;them;with;semicolons
|
||||||
//if set to false, everybody can use options on all images
|
//if set to false, everybody can use options on all images
|
||||||
//if image change code is not provided but the requested image (with options) already exists, it will render to the user just fine
|
//if image change code is not provided but the requested image (with options) already exists, it will render to the user just fine
|
||||||
define('IMAGE_CHANGE_CODE', false);
|
define('IMAGE_CHANGE_CODE', false);
|
||||||
|
|
||||||
// shall we log all uploaders IP addresses?
|
// shall we log all uploaders IP addresses?
|
||||||
define('LOG_UPLOADER', true);
|
define('LOG_UPLOADER', true);
|
||||||
|
|
||||||
//how many resizes may one image have?
|
//how many resizes may one image have?
|
||||||
//-1 = infinite
|
//-1 = infinite
|
||||||
//0 = none
|
//0 = none
|
||||||
define('MAX_RESIZED_IMAGES',20);
|
define('MAX_RESIZED_IMAGES',20);
|
||||||
|
|
||||||
//when the user requests a resize. Can the resized image be bigger than the original?
|
//when the user requests a resize. Can the resized image be bigger than the original?
|
||||||
define('ALLOW_BLOATING', false);
|
define('ALLOW_BLOATING', false);
|
||||||
|
|
||||||
//Force a specific domain for this server. If set to false, will autodetect.
|
//Force a specific domain for this server. If set to false, will autodetect.
|
||||||
//Format: https://your.domain.name/
|
//Format: https://your.domain.name/
|
||||||
define('FORCE_DOMAIN', false);
|
define('FORCE_DOMAIN', false);
|
||||||
|
|
||||||
//Shall errors be displayed to the user?
|
//Shall errors be displayed to the user?
|
||||||
//For dev environments: true, in production: false
|
//For dev environments: true, in production: false
|
||||||
define('SHOW_ERRORS', false);
|
define('SHOW_ERRORS', false);
|
||||||
0
js/helper.js
Normal file → Executable file
0
js/jquery-2.1.0.min.js
vendored
Normal file → Executable file
0
js/main.js
Normal file → Executable file
0
js/plugins.js
Normal file → Executable file
0
js/vendor/modernizr-2.6.2.min.js
vendored
Normal file → Executable file
0
js/vendor/zepto.min.js
vendored
Normal file → Executable file
9
models/pictsharemodel.php
Normal file → Executable file
@@ -126,6 +126,15 @@ class PictshareModel extends Model
|
|||||||
case 'smooth':
|
case 'smooth':
|
||||||
case 'contrast':
|
case 'contrast':
|
||||||
case 'blur':
|
case 'blur':
|
||||||
|
case 'sepia':
|
||||||
|
case 'sharpen':
|
||||||
|
case 'emboss':
|
||||||
|
case 'cool':
|
||||||
|
case 'light':
|
||||||
|
case 'aqua':
|
||||||
|
case 'fuzzy':
|
||||||
|
case 'boost':
|
||||||
|
case 'gray':
|
||||||
case 'pixelate': return true;
|
case 'pixelate': return true;
|
||||||
|
|
||||||
default: return false;
|
default: return false;
|
||||||
|
|||||||