Last active
December 28, 2015 12:19
-
-
Save jmvelasco/7499755 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## controller | |
public function renderScooterAction() | |
{ | |
$response = $this->getResponse(); | |
$im = ImageCreateTrueColor(640, 480); | |
$azul = ImageColorAllocate($im, 128, 128, 255); | |
$azul2 = ImageColorAllocate($im, 64, 64, 230); | |
$verde = ImageColorAllocate($im, 0, 64, 0); | |
$verde2 = ImageColorAllocate($im, 0, 200, 0); | |
// Ejes de coordenadas: | |
ImageLine($im, 0, 240, 640, 240, $verde2); | |
ImageLine($im, 320, 0, 320, 480, $verde2); | |
// Lineas de escala: | |
for($i = 50; $i < 320; $i+=50) { | |
ImageLine($im, 320+$i, 0, 320+$i, 480, $verde); | |
ImageLine($im, 320-$i, 0, 320-$i, 480, $verde); | |
} | |
for($i = 50; $i < 240; $i+=50) { | |
ImageLine($im, 0, 240+$i, 640, 240+$i, $verde); | |
ImageLine($im, 0, 240-$i, 640, 240-$i, $verde); | |
} | |
$y0 = $y1 = 240; | |
$x0 = $x1 = 0; | |
for($x1 = 0; $x1 < 640; $x1++) { | |
$y1 = 240 + 200*sin($x1/25); | |
ImageLine($im, $x0, $y0, $x1, $y1, $azul); | |
$x0 = $x1; | |
$y0 = $y1; | |
} | |
$y0 = $y1 = 240; | |
$x0 = $x1 = 0; | |
for($x1 = 0; $x1 < 640; $x1++) { | |
$y1 = 240 + 150*cos($x1/35); | |
ImageLine($im, $x0, $y0, $x1, $y1, $azul2); | |
$x0 = $x1; | |
$y0 = $y1; | |
} | |
ob_start(); | |
ImagePng($imgPng); | |
$image = ob_get_flush(); | |
$response = $this->getResponse(); | |
$response->setContent($image); | |
ImageDestroy($imgPng); | |
return $response; | |
} | |
## javascript | |
var imgSrc = '3PSCO/1P/Pictures/'+elementView[0]+'/Background/3PSC1P'+elementView[0]+elementView[2]+'B01A010_ZZZZZZZZ_'+elementView[3]+'_'+view[2]+'_01.png'; | |
//jQuery('#content_illu').css('background-image','url("'+img+'")'); | |
//jQuery('#content_illu').css('background-size','auto 737px'); | |
jQuery.ajax({ | |
type: 'POST', | |
url: '/renderscooter', | |
data: { img: imgSrc}, | |
cache: false | |
}) | |
.done(function( html ) { | |
$( '#content_illu' ).css('background-image', html ); | |
}); | |
jQuery(this).addClass('selected'); | |
## respuesta | |
�PNG | |
��� | |
IHDR��������� | |
.... | |
.... | |
.... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment