$info = getimagesize($image);
if ($info['mime'] === 'image/jpeg') {
...
}
Проверять лень, но что если подсунут под видом JPEG не картинку? С исключением ваш код не свалится?
server {
server_name test.ru www.test.ru ;
listen 81.177.49.137:443 ssl ;
ssl_certificate "/var/www/httpd-cert/test.ru_2024-03-04-08-31_14.crt";
ssl_certificate_key "/var/www/httpd-cert/test.ru_2024-03-04-08-31_14.key";
charset utf-8;
keepalive_timeout 3600;
keepalive_requests 2000;
reset_timedout_connection on;
gzip on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/css text/xml application/javascript text/plain application/json image/svg+xml image/x-icon;
gzip_comp_level 7;
set $root_path /var/www/test_usr/data/www/test.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
proxy_pass http://127.0.0.1:81;
proxy_redirect http://127.0.0.1:81/ /;
include /etc/nginx/proxy_params;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf|ico|7z|doc|docx|map|ogg|otf|pdf|tff|tif|txt|wav|webp|woff|woff2|xls|xlsx|xml)$ {
try_files $uri $uri/ @fallback;
expires 365d;
}
location @fallback {
proxy_pass http://127.0.0.1:81;
proxy_redirect http://127.0.0.1:81/ /;
include /etc/nginx/proxy_params;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
proxy_read_timeout 3600;
send_timeout 3600;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_connect_timeout 3600;
}
include "/etc/nginx/fastpanel2-sites/test_usr/test.ru.includes";
include /etc/nginx/fastpanel2-includes/*.conf;
error_log /var/www/test_usr/data/logs/test.ru-frontend.error.log;
access_log /var/www/test_usr/data/logs/test.ru-frontend.access.log;
}
server {
server_name test.ru www.test.ru ;
listen 81.177.49.137:80;
return 301 https://$host$request_uri;
error_log /var/www/test_usr/data/logs/test.ru-frontend.error.log;
access_log /var/www/test_usr/data/logs/test.ru-frontend.access.log;
}
2024/03/05 10:49:06 [error] 677#677: *3810 upstream timed out (110: Connection timed out) while reading response header from upstream, client:
504 Gateway Time-out
nginx/1.24.0
$domDoc = new DOMDocument();
$domDoc->load(ссылка на файл);
//create XPath object to navigate through the XML content.
$xpath = new DOMXPath($domDoc);
foreach ($xpath->query("//d:description") as $domNode) {
$domNode->nodeValue = '';
}
$xml = $domDoc->save();
$product_attribute_query = $this->db->query("SELECT name, `text`
FROM product
JOIN product_attribute USING (product_id)
JOIN attribute_description USING (attribute_id)
JOIN attribute USING (attribute_id)
WHERE product.grup_id = '".$grup_id."'
GROUP BY 1, 2
HAVING COUNT(*) >1")->rows;
Warning: imagecreatefromstring(): Data is not in a recognized format
честно говоря не понимаю, по идее должно дать false