› Foros › Off-Topic › Miscelánea
[PHP]<?
$max = 20;
$filename = "firma%s";
$rndnum = rand(1, $max);
$file = sprintf($filename, $rndnum);
header ( "Content-type: image/jpeg" );
readfile ( "firmas/" . $file . ".jpg");
exit;
?> [/PHP]
[PHP]<?
$font="./h.TTF";
/* So */
$dir="./firmas/"; //t
$types=array('jpg'=>'jpeg','jpeg'=>'jpeg','pjpeg'= >'jpeg','png'=>'png');
$dh=opendir($dir);
while($data=readdir($dh)){
if($data=='..' || $data=='.' || is_dir($dir.$data))
continue;
$temp_ext=explode('.',strrev($data),2);
$temp_ext=strrev($temp_ext[0]);
if($types[$temp_ext] || $_GET['debug'])
$sigs[]=$data;
}
mt_srand((double)microtime()*10000000);
$i=mt_rand(0,(count($sigs)-1));
$sig=$dir.$sigs[$i];
$ext=explode('.',strrev($sig),2);
$ext=strrev($ext[0]);
$type=$types[$ext];
if(!$type){
header('content-type: image/jpeg');
$im=imagecreate(500,100);
$white=imagecolorallocate($im,255,255,255);
$black=imagecolorallocate($im,0,0,0);
imagefill($im,0,0,$white);
imagettftext($im,13,0,0,10,$black,$dir.$font,'Exte nsión del archivo inaceptable'.$ext);
imagejpeg($im,'',100);
imagedestroy($im);
}else{
header("Content-Type: image/{$type}");
readfile($sig);
}
?> [/PHP]
PD2: Hace falta un Subforo de Diseño Gráfico o algo donde postear estas cosas, que he dudado entre varios subforos antes de venir aquí xD
[PHP]<?
$max = 20;
$filename = "firma%s";
$rndnum = rand(1, $max);
$file = sprintf($filename, $rndnum);
header ( "Content-type: image/jpeg" );
readfile ( "firmas/" . $file . ".jpg");
exit;
?> [/PHP]
darkrocket escribió:Pues algún problema habrá, porque intento guardar el .php en mi disco y me salén un monton de líneas de código extraño.
Te recomiendo usar 110mb. Creas una carpeta llamada firmas, subes todas las imágenes al directorio (se tienen que llamar firma1.jpg, firma2.jpg...) y subes el php a la raiz del ftp:[PHP]<?
$max = 20;
$filename = "firma%s";
$rndnum = rand(1, $max);
$file = sprintf($filename, $rndnum);
header ( "Content-type: image/jpeg" );
readfile ( "firmas/" . $file . ".jpg");
exit;
?> [/PHP]
<?php
$img[1] = 'URL';
$img[2] = 'URL';
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Pragma: no-cache');
header('Content-type: image/gif');
$imagen = @imagecreatefrompng($img[rand(1,2)]);
imagegif($imagen);
imagedestroy($imagen);
?>
$imagen = @imagecreatefrompng($img[rand(1,2)]);
$img[1] = 'URL';
$img[2] = 'URL';
$img[3] = 'URL';
$img[4] = 'URL';
$img[5] = 'URL';