Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php header("Content-Type: image/png"); // Crear imagen base de 200x200 píxeles $image = imagecreatetruecolor(200, 200); // Definir color de fondo blanco $fondo = imagecolorallocate($image, 255, 255, 255); imagefill($image, 0, 0, $fondo); // Color azul para la onda $colorPatron = imagecolorallocate($image, 0, 0, 255); // Llamar la función Onda drawOndaOriginal($image, 0, 0, 200, $colorPatron); // Función definida tal cual la necesitas para tu formulario function drawOndaOriginal( \GdImage $baseImage, int $rowIndex, int $columnIndex, int $baseBlockSize, int $foregroundColor ): void { $startX = $columnIndex * $baseBlockSize; $startY = $rowIndex * $baseBlockSize + ($baseBlockSize / 2); imagesetthickness($baseImage, 2); for ($x = 0; $x < $baseBlockSize; $x++) { $y = (int)($startY + sin(deg2rad($x * (360 / $baseBlockSize))) * ($baseBlockSize / 4)); imagefilledellipse($baseImage, $startX + $x, $y, 2, 2, $foregroundColor); } } // Mostrar imagen PNG generada imagepng($image); // Liberar memoria imagedestroy($image); ?>
Copy Clear