# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all md5
host replication all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
host replication all ::1/128 md5
hostssl all all 0.0.0.0/0 md5
Image converted: uploads/How to extract text from PDF offline.png
Image converted: uploads/how-to.png
Image converted: uploads/ppt converter.png
Image converted: uploads/How to convert eBook to PDF.gif
Image converted: uploads/How to extract text from PDF online.gif
Conversion completed.
# Используем образ PHP с Apache
FROM php:7.4-apache
# Установка дополнительных пакетов, необходимых для работы Imagick
RUN apt-get update && apt-get install -y \
libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get install php
# Копируем исходный код приложения в директорию /var/www/html в контейнере
COPY . /var/www/html
RUN chmod -R 777 /var/www/html
# Указываем рабочую директорию
WORKDIR /var/www/html
# Команда для выполнения PHP скрипта перед запуском Apache
CMD php convertImages.php && apachectl -D FOREGROUND
<?php
// Directory containing article images
$imagesDir = '/var/www/html/uploads';
// Get all image files
$allowedExtensions = ['png', 'gif', 'jpg', 'jpeg'];
$images = [];
foreach ($allowedExtensions as $extension) {
$images = array_merge($images, glob("$imagesDir/*.$extension"));
}
// Convert each image to WebP format
foreach ($images as $image) {
// Check if the image file exists
if (file_exists($image)) {
// Create Imagick object for the image
$imagick = new Imagick($image);
// Set image quality (optional)
$imagick->setImageCompressionQuality(80);
// Define the WebP image file name
$webpImage = str_replace($allowedExtensions, 'webp', $image);
// Convert the image to WebP format
$imagick->setImageFormat('webp');
$imagick->writeImage($webpImage);
// Clear Imagick object from memory
$imagick->clear();
$imagick->destroy();
echo "Image converted: $image\n";
} else {
echo "Image not found: $image\n";
}
}
echo "Conversion completed.\n";
Saving file 'uploads/How to extract text from PDF offline.webp'
File: uploads/How to extract text from PDF offline.png
Dimension: 800 x 526
Output: 18372 bytes Y-U-V-All-PSNR 45.52 48.36 48.63 46.31 dB
(0.35 bpp)
block count: intra4: 458 (27.76%)
intra16: 1192 (72.24%)
skipped: 1066 (64.61%)
bytes used: header: 293 (1.6%)
mode-partition: 2561 (13.9%)
Residuals bytes |segment 1|segment 2|segment 3|segment 4| total
macroblocks: | 3%| 12%| 25%| 60%| 1650
quantizer: | 27 | 26 | 22 | 16 |
filter level: | 8 | 5 | 5 | 3 |
Image converted: uploads/How to extract text from PDF offline.png
Saving file 'uploads/how-to.webp'
File: uploads/how-to.png
Dimension: 800 x 384
Output: 16984 bytes Y-U-V-All-PSNR 44.53 49.21 49.21 45.60 dB
(0.44 bpp)
block count: intra4: 270 (22.50%)
intra16: 930 (77.50%)
skipped: 815 (67.92%)
bytes used: header: 312 (1.8%)
mode-partition: 1628 (9.6%)
Residuals bytes |segment 1|segment 2|segment 3|segment 4| total
macroblocks: | 1%| 8%| 14%| 76%| 1200
quantizer: | 27 | 27 | 24 | 17 |
filter level: | 8 | 5 | 5 | 2 |
Image converted: uploads/how-to.png
Saving file 'uploads/ppt converter.webp'
File: uploads/ppt converter.png
Dimension: 800 x 420
Output: 9678 bytes Y-U-V-All-PSNR 47.97 48.77 48.94 48.24 dB
(0.23 bpp)
block count: intra4: 141 (10.44%)
intra16: 1209 (89.56%)
skipped: 1009 (74.74%)
bytes used: header: 280 (2.9%)
mode-partition: 1281 (13.2%)
Residuals bytes |segment 1|segment 2|segment 3|segment 4| total
macroblocks: | 1%| 3%| 11%| 85%| 1350
quantizer: | 27 | 27 | 24 | 18 |
filter level: | 8 | 6 | 5 | 2 |
Image converted: uploads/ppt converter.png
Saving file 'uploads/ppt converter.webp'
File: uploads/ppt converter.jpg
Dimension: 800 x 506
Output: 18500 bytes Y-U-V-All-PSNR 45.20 48.65 49.07 46.11 dB
(0.37 bpp)
block count: intra4: 352 (22.00%)
intra16: 1248 (78.00%)
skipped: 1035 (64.69%)
bytes used: header: 301 (1.6%)
mode-partition: 2235 (12.1%)
Residuals bytes |segment 1|segment 2|segment 3|segment 4| total
macroblocks: | 2%| 4%| 22%| 73%| 1600
quantizer: | 27 | 27 | 23 | 17 |
filter level: | 8 | 6 | 5 | 2 |
Image converted: uploads/ppt converter.jpg
Conversion completed.a
FedoraServer (default, active)
target: default
ingress-priority: 0
egress-priority: 0
icmp-block-inversion: no
interfaces: enp6s0
sources:
services: cockpit dhcpv6-client docker-registry docker-swarm kodi-http plex postgresql samba ssh
ports:
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: