mirror of
https://github.com/ivuorinen/palette.git
synced 2026-03-16 10:02:31 +00:00
Code style changes and added travis build badge to README
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
Palette
|
Palette [](https://travis-ci.org/ivuorinen/palette)
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Palette is a PHP class that takes your images and returns used colors, sorts them by usage and saves the results.
|
Palette is a PHP class that takes your images and returns used colors, sorts them by usage and saves the results.
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Palette
|
* Palette
|
||||||
* Parses image and returns most used colors
|
* Parses image and returns most used colors
|
||||||
*
|
*
|
||||||
* PHP version 5
|
|
||||||
*
|
|
||||||
* MIT License
|
* MIT License
|
||||||
* ===========
|
* ===========
|
||||||
*
|
*
|
||||||
@@ -163,9 +161,9 @@ class Palette
|
|||||||
|
|
||||||
if (! empty($this->colorsArray) and is_array($this->colorsArray)) {
|
if (! empty($this->colorsArray) and is_array($this->colorsArray)) {
|
||||||
return $this->colorsArray;
|
return $this->colorsArray;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,9 +253,8 @@ class Palette
|
|||||||
file_put_contents($this->destination, $colorsData);
|
file_put_contents($this->destination, $colorsData);
|
||||||
if (is_readable($this->destination)) {
|
if (is_readable($this->destination)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -323,11 +320,10 @@ class Palette
|
|||||||
|
|
||||||
// Test if we can write to it
|
// Test if we can write to it
|
||||||
try {
|
try {
|
||||||
if (! is_writable($destination_dir)) {
|
if (is_writable($destination_dir)) {
|
||||||
chmod($destination_dir, 0755);
|
|
||||||
} else {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
chmod($destination_dir, 0755);
|
||||||
|
|
||||||
if (! is_writable($destination_dir)) {
|
if (! is_writable($destination_dir)) {
|
||||||
throw new \Exception("Destination directory not writable: {$destination_dir}");
|
throw new \Exception("Destination directory not writable: {$destination_dir}");
|
||||||
|
|||||||
Reference in New Issue
Block a user