Codice PHP:
<?php
function createimg($Stringa){
$lenght = strlen($Stringa);
$photoFrame = imagecreatetruecolor(380,285);
$bg = imagecolorallocate ( $photoFrame, 255, 255, 255 );
imagefill ( $photoFrame , 0, 0, $bg );
//$immagine = imagecreatetruecolor($larghezza, $altezza);
//$sfondo = imagecolorallocatealpha($photoFrame, 0xFF, 0, 0, 0);
$bianco = imagecolorallocatealpha($photoFrame, 0xFF, 0xFF, 0xFF, 0);
$directory = '.../.../'; $d = dir($directory);
$immaginefinale = $path."immaginecompleta.png"; //immagine finale che verra creata $lettere = array("A","B","C","D","E","F","G","H","I","J","0","1","2","3","4","5","6","7","8","9"); $lunghezzaarray = (sizeof($lettere));
$carica = array();
$fotogrammaW = 65; //base fotogramma
$fotogrammaH = 80; //altezza fotogramma
for ($mul = 0; $mul <= $lenght-1; ++$mul) {
for ($con = 0; $con <= $lunghezzaarray-1; ++$con) {
$let1= ord($Stringa{$mul});
$let2 = ord($lettere[$con]);
if($let1 == $let2){ echo($path.$lettere[$con].'.png');
$carica[$mul] = imagecreatefrompng($path.$lettere[$con].'.png');
}
}
}
//imagecopy($photoFrame, (imagecreatefrompng($folder.'testa.png')), 0, 0, 0, 0, 377,45); imagecopy($photoFrame, ($carica[0]), 0, 50, 0, 0, $fotogrammaW, $fotogrammaH); //copia la prima immagine imagecopy($photoFrame, ($carica[1]), 76, 50, 0, 0, $fotogrammaW, $fotogrammaH); //copia la seconda immagine spostata di 150 imagecopy($photoFrame, ($carica[2]), 152, 50, 0, 0, $fotogrammaW, $fotogrammaH); //copia la terza immagine spostata di 300 imagecopy($photoFrame, ($carica[3]), 228, 50, 0, 0, $fotogrammaW, $fotogrammaH); //copia la quarta immagine spostata di 450 imagecopy($photoFrame, ($carica[4]), 304, 50, 0, 0, $fotogrammaW, $fotogrammaH); //copia la quinta immagine spostata di 600 imagepng($photoFrame, $immaginefinale); //crea l'immagine finale // File and rotation $filename = 'immaginecompleta.png'; $degrees = 90; // Load $source = imagecreatefrompng($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); // Output imagepng($rotate,$immaginefinale); }