PHP code example of grocerycrud / image-crud

1. Go to this page and download the library: Download grocerycrud/image-crud library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

grocerycrud / image-crud example snippets




namespace App\Controllers;

use ImageCrud\Core\ImageCrud;

class ImagesExamples extends BaseController
{

    private function _example_output($output = null) {
        if (isset($output->isJSONResponse) && $output->isJSONResponse) {
            header('Content-Type: application/json; charset=utf-8');
            echo $output->output;
            exit;
        }

        return view('image_crud/template.php', (array)$output);
    }

    public function example1(): string
    {
        $imageCrud = new ImageCrud();

        $imageCrud->setPrimaryKeyField('id');
        $imageCrud->setUrlField('url');
        $imageCrud->setTable('example_1')
            ->setImagePath('uploads');

        $output = $imageCrud->render();

        return $this->_example_output($output);
    }
}
bash
composer ocerycrud/image-crud/src/ImageCrud/ImageCrudPublisher.php app/Publishers
php spark publish