done
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
0da816ca35
commit
166f25470d
|
@ -1,4 +1,4 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule ^(.+)\.(jpg|png|jpeg)$ script.pl?name=$1 [L,QSA]
|
||||
RewriteRule ^(.+)\.(jpg|png|jpeg)$ script.pl?value=$1.$2&name=$1 [L,QSA]
|
||||
</IfModule>
|
||||
|
|
|
@ -1,53 +1,27 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use Cwd qw(abs_path);
|
||||
|
||||
my $script_path = abs_path($0);
|
||||
use CGI;
|
||||
use Digest::SHA qw(sha1_hex);
|
||||
my $pwd = `pwd`;
|
||||
|
||||
my $cgi = CGI->new;
|
||||
my $query_string = $ENV{'QUERY_STRING'};
|
||||
# print "Content-type: text/html\n\n";
|
||||
|
||||
# print $cgi->header('text/javascript');
|
||||
my $name = $cgi->param('name') || 'default';
|
||||
my $ext = $cgi->param('ext') || 'default';
|
||||
my $param = $cgi->param('param') || 'default';
|
||||
|
||||
# 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_value = $cgi->param('value') || "Hola, mundo!";
|
||||
|
||||
# Calcula el valor hash MD5 del string
|
||||
my $hash_value = sha1_hex($input_string);
|
||||
# Obtiene solo los 2 primeros caracteres del hash MD5
|
||||
my $first_characters = substr($hash_value, 2, 2);
|
||||
# Obtiene solo los 2 primeros caracteres del hash MD5
|
||||
# Obtiene solo los 2 segundos caracteres del hash MD5
|
||||
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";
|
||||
my $new_path ="images/transform/$first_characters/$second_characters/$input_value";
|
||||
# Imprime el resultado
|
||||
# print "String: $input_string\n";
|
||||
# print "Hash MD5: $hash_value\n";
|
||||
# Contenido HTML o cualquier otra salida del script
|
||||
# print "<html><body style=' margin: 0px;
|
||||
# height: 100%;
|
||||
# background-color: rgb(14, 14, 14);'>
|
||||
# <h1>$ext</h1>
|
||||
# <h1>$script_path</h1>
|
||||
# <h1>$new_path</h1>
|
||||
# <h1>$input_string</h1>
|
||||
# <h1>$pwd</h1>
|
||||
# <h1>$query_string</h1>
|
||||
# <h1>$request_path</h1>
|
||||
# <h1>$hash_value</h1>
|
||||
# <h1>$first_characters</h1>
|
||||
# <h1>$second_characters</h1>
|
||||
# Establecer el tipo de contenido a imagen JPEG
|
||||
print "Content-type: image/jpeg\n\n";
|
||||
|
||||
# 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: $!";
|
||||
open my $imagen, '<', $new_path or die "No se pudo abrir la imagen: $!";
|
||||
|
||||
# Imprime los bytes de la imagen directamente en la salida estándar
|
||||
binmode STDOUT;
|
||||
|
@ -55,9 +29,3 @@ 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