public static function init()
 {
     self::$cacheDir = '../../../' . Config::$cache_folder . '/images';
     self::$documentRoot = '../../..';
     // This must be the last line of this function
     parent::init();
 }
Exemple #2
0
 public static function init()
 {
     parent::init();
     self::$enableRequestCache = (bool) IMAGE::$config['cache'];
     self::$defaultImagePath = (string) IMAGE::$config['defaultImage'];
     self::$defaultQuality = (int) IMAGE::$config['defaultQuality'];
     self::$browserCacheTTL = (int) IMAGE::$config['browserCacheLifetime'];
     self::$garbageCollectFileCacheMaxLifetime = (int) IMAGE::$config['serverCacheLifetime'];
     self::$cacheDir = (string) IMAGE::$config['cacheDir'];
     self::$pathToCacheDir = (string) IMAGE::$config['pathToCacheDir'];
     if (!is_dir(self::$pathToCacheDir)) {
         $cachePath = explode('/', self::$cacheDir);
         $count = count($cachePath);
         $currentPath = IMAGE::$config['documentRoot'];
         for ($i = 0; $i < $count; $i++) {
             if ($cachePath[$i] !== '') {
                 $currentPath = $currentPath . '/' . $cachePath[$i];
                 if (!is_dir($currentPath)) {
                     mkdir($currentPath);
                 }
             }
         }
         chmod(self::$pathToCacheDir, 0777);
     }
 }
 public static function init()
 {
     if (isset($_GET['users'])) {
         self::$documentRoot = '../../../../files/uploads/users';
     }
     // This must be the last line of this function
     parent::init();
 }
 /**
  * @return void
  */
 protected function setUp()
 {
     $this->slir = new SLIR();
     SLIRConfig::$defaultImagePath = null;
     SLIRConfig::$forceQueryString = false;
     SLIRConfig::$enableErrorImages = false;
     SLIRConfig::$defaultCropper = SLIR::CROP_CLASS_CENTERED;
     SLIRConfig::$copyEXIF = false;
     SLIRConfig::$maxMemoryToAllocate = -1;
     // Try to fix documentRoot for CLI
     SLIRConfig::$documentRoot = realpath(__DIR__ . '/../../');
 }
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with SLIR.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @copyright Copyright © 2011, Joe Lencioni
 * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
 * @since 2.0
 * @package SLIR
 */
require_once 'core/slirconfigdefaults.class.php';
/**
 * SLIR Config Class
 *
 * @since 2.0
 * @author Joe Lencioni <*****@*****.**>
 * @package SLIR
 */
class SLIRConfig extends SLIRConfigDefaults
{
    // override configuration values here
    public static function init()
    {
        // This must be the last line of this function
        parent::init();
    }
}
SLIRConfig::init();
 /**
  * @test
  */
 public function initializeUnforcedQueryStringWidthAndImage()
 {
     SLIRConfig::$forceQueryString = false;
     $request = new SLIRRequest();
     $_SERVER['QUERY_STRING'] = 'i=/slir/Test/images/camera-logo.png&w=100';
     $_GET = array();
     $_GET['i'] = '/slir/Test/images/camera-logo.png';
     $_GET['w'] = '100';
     $request->initialize();
     $this->assertSame($request->path, $_GET['i']);
     $this->assertSame($request->width, 100);
 }