approach
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
838c56d770
commit
0da816ca35
|
@ -1,4 +1,4 @@
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteRule ^(.+)\.(jpg|png|jpeg)$ script.pl?name=$1&ext=$2 [L,QSA]
|
RewriteRule ^(.+)\.(jpg|png|jpeg)$ script.pl?name=$1 [L,QSA]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
|
@ -40,7 +40,7 @@ COPY apache2.conf /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
||||||
COPY www/ /usr/local/apache2/htdocs/
|
COPY www/ /usr/local/apache2/htdocs/
|
||||||
|
|
||||||
# Copia las imágenes al directorio htdocs/images
|
# Copia las imágenes al directorio htdocs/images
|
||||||
COPY images/ /usr/local/apache2/htdocs/images/
|
# COPY images/ /usr/local/apache2/htdocs/images/
|
||||||
|
|
||||||
# Copia el archivo .htaccess para configurar el directorio htdocs/images
|
# Copia el archivo .htaccess para configurar el directorio htdocs/images
|
||||||
COPY .htaccess /usr/local/apache2/htdocs/
|
COPY .htaccess /usr/local/apache2/htdocs/
|
||||||
|
@ -50,3 +50,6 @@ RUN chmod +x /usr/local/apache2/cgi-bin/script.pl
|
||||||
# Habilitar reescritura y reiniciar Apache2
|
# Habilitar reescritura y reiniciar Apache2
|
||||||
RUN echo "RewriteEngine On" >> /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
RUN echo "RewriteEngine On" >> /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
||||||
RUN echo "Include conf/extra/httpd-vhosts.conf" >> /usr/local/apache2/conf/httpd.conf
|
RUN echo "Include conf/extra/httpd-vhosts.conf" >> /usr/local/apache2/conf/httpd.conf
|
||||||
|
|
||||||
|
# CMD y ENTRYPOINT para iniciar Apache2, según la imagen original
|
||||||
|
CMD ["httpd-foreground"]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Directory "/usr/local/apache2/cgi-bin">
|
<Directory "/usr/local/apache2/cgi-bin">
|
||||||
|
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
AddHandler cgi-script .pl
|
AddHandler cgi-script .pl
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
apache:
|
apache:
|
||||||
|
volumes:
|
||||||
|
- ./images:/usr/local/apache2/htdocs/images/
|
||||||
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
|
@ -1,42 +1,63 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use Cwd qw(abs_path);
|
||||||
|
|
||||||
|
my $script_path = abs_path($0);
|
||||||
use CGI;
|
use CGI;
|
||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::SHA qw(sha1_hex);
|
||||||
|
my $pwd = `pwd`;
|
||||||
my $cgi = CGI->new;
|
my $cgi = CGI->new;
|
||||||
|
my $query_string = $ENV{'QUERY_STRING'};
|
||||||
|
# print "Content-type: text/html\n\n";
|
||||||
|
|
||||||
print "Content-type: text/html\n\n";
|
|
||||||
# print $cgi->header('text/javascript');
|
# print $cgi->header('text/javascript');
|
||||||
my $name = $cgi->param('name') || 'default';
|
my $name = $cgi->param('name') || 'default';
|
||||||
my $ext = $cgi->param('ext') || 'default';
|
my $ext = $cgi->param('ext') || 'default';
|
||||||
my $param = $cgi->param('param') || 'default';
|
my $param = $cgi->param('param') || 'default';
|
||||||
|
|
||||||
# Obtén el string desde la línea de comandos o proporciona un valor predeterminado
|
# Obtén el string desde la línea de comandos o proporciona un valor predeterminado
|
||||||
|
# print "Ruta del script Perl: ";
|
||||||
my $input_string = $cgi->param('name') || "Hola, mundo!";
|
my $input_string = $cgi->param('name') || "Hola, mundo!";
|
||||||
|
|
||||||
# Calcula el valor hash MD5 del string
|
# Calcula el valor hash MD5 del string
|
||||||
my $hash_value = md5_hex($input_string);
|
my $hash_value = sha1_hex($input_string);
|
||||||
# Obtiene solo los 2 primeros caracteres del hash MD5
|
# Obtiene solo los 2 primeros caracteres del hash MD5
|
||||||
my $first_characters = substr($hash_value, 0, 2);
|
my $first_characters = substr($hash_value, 2, 2);
|
||||||
# Obtiene solo los 2 primeros caracteres del hash MD5
|
# Obtiene solo los 2 primeros caracteres del hash MD5
|
||||||
my $second_characters = substr($hash_value, 2, 2);
|
my $second_characters = substr($hash_value, 0, 2);
|
||||||
|
my $request_path = $ENV{'REQUEST_PATH'} || '';
|
||||||
|
my $new_path ="../../images/transform/$first_characters/$second_characters/$input_string";
|
||||||
# Imprime el resultado
|
# Imprime el resultado
|
||||||
print "String: $input_string\n";
|
# print "String: $input_string\n";
|
||||||
print "Hash MD5: $hash_value\n";
|
# print "Hash MD5: $hash_value\n";
|
||||||
# Contenido HTML o cualquier otra salida del script
|
# Contenido HTML o cualquier otra salida del script
|
||||||
print "<html><body style=' margin: 0px;
|
# print "<html><body style=' margin: 0px;
|
||||||
height: 100%;
|
# height: 100%;
|
||||||
background-color: rgb(14, 14, 14);'>
|
# background-color: rgb(14, 14, 14);'>
|
||||||
<h1>$ext</h1>
|
# <h1>$ext</h1>
|
||||||
<h1>$input_string</h1>
|
# <h1>$script_path</h1>
|
||||||
<h1>$hash_value</h1>
|
# <h1>$new_path</h1>
|
||||||
<h1>$first_characters</h1>
|
# <h1>$input_string</h1>
|
||||||
<h1>$second_characters</h1>
|
# <h1>$pwd</h1>
|
||||||
<img style= 'display: block;
|
# <h1>$query_string</h1>
|
||||||
-webkit-user-select: none;
|
# <h1>$request_path</h1>
|
||||||
margin: auto;
|
# <h1>$hash_value</h1>
|
||||||
cursor: zoom-in;
|
# <h1>$first_characters</h1>
|
||||||
background-color: hsl(0, 0%, 90%);
|
# <h1>$second_characters</h1>
|
||||||
transition: background-color 300ms;' src='../images/$name.jpg' width='100%' height='100%' alt='' srcset=''></body></html>";
|
# Abre la imagen en modo binario
|
||||||
|
print "Content-type: image/jpeg\n\n"
|
||||||
|
open my $imagen, '<', '../images/_DSC5308.jpg' or die "No se pudo abrir la imagen: $!";
|
||||||
|
|
||||||
|
# Imprime los bytes de la imagen directamente en la salida estándar
|
||||||
|
binmode STDOUT;
|
||||||
|
print while <$imagen>;
|
||||||
|
|
||||||
|
# Cierra el archivo
|
||||||
|
close $imagen;
|
||||||
|
# print "<img style= 'display: block;
|
||||||
|
# -webkit-user-select: none;
|
||||||
|
# margin: auto;
|
||||||
|
# cursor: zoom-in;
|
||||||
|
# background-color: hsl(0, 0%, 90%);
|
||||||
|
# transition: background-color 300ms;' src='../../images/_DSC5308.jpg' width='100%' height='100%' alt='' srcset=''>";
|
||||||
|
|
Loading…
Reference in New Issue