 
  
   
  
  $CAL_BATCH_URL = 'https://www.googleapis.com/batch';
    $ch = curl_init($CAL_BATCH_URL);
    $access_token = 'myToken';
    $boundary = 'batch_' . uniqid();
    $data = '';
    $data .= "--" . $boundary . "\r\n";
    $data .= 'Content-Type: application/http' . "\r\n";
    $data .= 'Content-ID: ' . "\r\n";
    $data .= 'Content-Transfer-Encoding: binary' . "\r\n\r\n";
    // Add batches
    foreach ($content as $one_request_item) {
        $data .= "--" . $boundary . "\r\n"
            . 'POST ' . '/v3/urlNotifications:publish' . "\r\n"
            . 'Content-Type: application/json' . "\r\n"
            . 'Content-Length: ' . strlen(json_encode($one_request_item)) . "\r\n\r\n";
        $data .= json_encode($one_request_item) . "\r\n\r\n";
    }
    // Headers
    $headers = array(
        "Authorization: Bearer " . $access_token,
        "Host: www.googleapis.com",
        "Content-Type: multipart/mixed; boundary={$boundary}",
        'Content-Length: ' . strlen(json_encode($content))
    );
    // Curl Setup
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLINFO_HEADER_OUT, true);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    $response = curl_exec($ch); 
  
   
  
  <form action="admin" method="post" enctype="multipart/form-data">
    <input type="text" name="name">
    <input type="text" name="description">
    <input type="submit" name="myform" value="OK">
    <p>Загрузить картинку</p>
    <input type="file" name="img_upload">
</form>Можно убрать отдельную кнопку Загрузить и оставить только одну кнопку со свойством submit.
А проверять наличие картинки по полю <i>$_FILES['img_upload']</i>
<code lang="html">
<form action="admin" method="post" enctype="multipart/form-data">
    <input type="text" name="name">
    <input type="text" name="description">
    <input type="submit" name="myform" value="OK">
    <p>Загрузить картинку</p>
    <input type="file" name="img_upload">
</form>
</code>
<code lang="php">
if (isset($_POST["name"]) && isset($_FILES['img_upload'])) {
    try {
        $img_type = substr($_FILES['img_upload']['type'], 0, 5);
        $img_size = 2 * 1024 * 1024;
        if (!empty($_FILES['img_upload']['tmp_name']) and $img_type === 'image' and $_FILES['img_upload']['size'] <= $img_size) {
            $img = addslashes(file_get_contents($_FILES['img_upload']['tmp_name']));
        }
    }
    catch (Throwable $exception)
    {
        exit('<p>Не удалось сохранить файл</p>');
    }
    $sql = mysqli_query($connection, "INSERT INTO `catalog` (`name`, `description`, `img`) VALUES ('{$_POST['name']}', '{$_POST['description']}', '{$img}')");
    if ($sql) {
        echo '<p>Данные успешно добавлены в таблицу.</p>';
    } else {
        echo '<p>Произошла ошибка: ' . mysqli_error($link) . '</p>';
    }
}
</code> 
  
   
  
  $zoo_store = new ZooStore();
$visitor = new Human(new HumanVoiceEngine());
$animal_type = $_GET['animal_type'];
switch ($animal_type) {
    case 'cat':
        $animal = new Cat(new CatVoiceEngine());
        break;
    case 'dog':
        $animal = new Cat(new CatVoiceEngine());
        break;
     default:
       errorHandler();
        break;
}
$zoo_store->OpenСageWithLabel($visitor, $animal);
class ZooStore
{
    /**
     * Открыть для посетителя Клетку с КОНКРЕТНЫМ животным
     * @param Human $visitor
     * @param Animal $animal
     */
    public function OpenСageWithLabel(Human $visitor, Animal $animal)
    {
        $visitor->touchAnimal($animal);
    }
} 
  
  class ZooStore
{
    /**
     * Открыть для посетителя Клетку с табличкой, на которой Написан Вид животного (например, 'cat')
     * @param Human $visitor
     * @param string $label
     */
    public function OpenСageWithLabel(Human $visitor, string $label)
    {
        switch ($label) {
            case 'cat':
                $animal = new Cat(new HumanVoiceEngine()); //не относится к вопросу: кошка может заговорить из-за слабой связности?
                break;
            case 'dog':
                $animal = new Dog(new DogVoiceEngine());
                break;
        }
        $visitor->touchAnimal($animal);
    }
} 
  
  class Human
{
    public  $animals = [
        'dog' => Dog::class,
        'cat' => Cat::class,
    ];
    public function touchAnimal($animal_type)
    {
        $animal = $this->getAnimal($animal_type);
        $animal->say();
    }
    public function getAnimal($name): VoiceAnimal
    {
        return $this->animals[$name]();
    }
} 
  
  $home_animals = [
            'dog' => Dog::class,
            'cat' => Cat::class,
        ];animal  = new Dog();
$animal->say(); // IDE подсказывает, что у объекта $animal можно вызвать say
   $animal = new $this->home_animals[$animal_type](); 
        $animal->say();  // IDE перестаёт знать объектом какого класса является переменная и не подсказывает 
  
  Supplier<Voice> supplier = suppliers.get(type);Voice $supplier = $suppliers.get(type);
// или 
$supplier = (Voice) $suppliers.get(type); 
  
  
 
  
  $(document).ready(function () {
     // способ 1
    $("img[async-src]").each(function (index) {
        // $(this).attr("src", $(this).attr("async-src"));
        
        setTimeout(function () {
            $(this).attr("src", $(this).attr("async-src"));
        }, 5000);
    });
    // способ 2
    $("img[async-src]").each(function (index) {
        let self = $(this).parent();
        let src = $(this).attr("async-src");
        setTimeout(function () {
           
            var img = new Image();
            img.onload = function () {
                self.append(img)
            };
            img.src = src;
        }, 5000);
    });
  }); 
  
  Атрибут loading элемента (или loading (en-US) атрибут для (en-US)) могут быть использованы, чтобы указать браузеру на необходимость отложить загрузку изображений / iframe до тех пор, пока пользователь не доскроллит до них.
 
  
   
  
  "message": {
        "attachment": {
            "type": "template",
            "payload": {
                "template_type": "generic",
                "elements": [
                    {
                        "title": "Welcome!",  // обязательно указывать
                        "buttons": [
                            {
                                "type": "postback",
                                "title": "Start Chatting",
                                "payload": "DEVELOPER_DEFINED_PAYLOAD"
                            }
                        ]
                    }
                ]
            }
        }
    }