Indice del forum Olimpo Informatico
I Forum di Zeus News
Leggi la newsletter gratuita - Attiva il Menu compatto
 
 FAQFAQ   CercaCerca   Lista utentiLista utenti   GruppiGruppi   RegistratiRegistrati 
 ProfiloProfilo   Messaggi privatiMessaggi privati   Log inLog in 

    Newsletter RSS Facebook Twitter Contatti Ricerca
[PHP] RoundedPhp: Api x creare angoli arrotondati on the fly
Nuovo argomento   Rispondi    Indice del forum -> Linguaggi per Internet
Precedente :: Successivo  
Autore Messaggio
kluster
Dio maturo
Dio maturo


Registrato: 15/04/06 13:14
Messaggi: 2898

MessaggioInviato: 06 Dic 2007 13:44    Oggetto: [PHP] RoundedPhp: Api x creare angoli arrotondati on the fly Rispondi

Rounded PHP è un API for creare immagini con angoli arrotondati anti-aliased al volo.
Utilizza le library GD interne di PHP5+ e la creazione delle immagini è molto versatile e basta configurarla con semplici parametri.

Qui una demo:
http://dev.kingthief.com/demos/roundedphp/

l'implementazione è molto semplice. Esempio si vuole richiamare un immagine *
Citazione:

<img src="/path/to/rounded.php?shape=r&w=200&h=150&r=20&bw=1&bc=FFF&bg=EFEFEF&fg=000&f=gif"/>

genera questo:


dove i parametri da personalizzare sono i seguenti (tra parentesi quadre la forma contratta):

Citazione:

shape = {'r' (or 'rect' or 'rectangle'), 'c' (or 'corner'), 's' (or 'side')}
[sh]
# shape of output image
# (rounded rectangle, rounded corner,
# side of rectangle)

radius = {0, 1, ... , n} # outer radius of the rounded corners
[r]

width = {2, 3, ... , n} # width of rounded rectangle (and top
[w] # and bottom side images)

height = {2, 3, ... , n} # height of rounded rectangle (and left
[h] # and right side images)

foreground = 3 or 6 character hex code # foreground color (inside of arc)
[fg]

background = 3 or 6 character hex code # background color
[bg]

bordercolor = 3 or 6 character hex code # border color
[bc]

borderwidth = {0, 1, ... , n} # border width
[bw]

orientation = {'tl' (or 'lt'), 'tr' (or 'rt'), 'bl' (or 'lb'), 'br' (or 'rb')}
[o]
# orientation of a corner image
# if that shape is requested

side = {'t' (or 'top'), 'l' (or 'left'), 'r' (or 'right'), 'b' (or 'bottom')}
[si]
# which side of the rectangle to generate
# if that shape is requested

format = {'png', 'gif', 'jpg' (or 'jpeg')} # image output format
[f]


può essere molto comodo per la generazione dei layer con angoli arrotondati senza uso di javascript o css aggiuntivo.
Codice:

<style="text/css">
div#myLayer
{
background-image:url('rounded.php?shape=r&w=200&h=150&r=20&bw=2&bc=FFF&bg=EFEFEF&fg=000&f=gif');
width:200px;
height:150px;
color:white;
padding:5px;
...etc etc
}
</style>



* ho simulato la trasparenza con EFEFEF che è il colore di sfondo di questo post.
Top
Profilo Invia messaggio privato
Mostra prima i messaggi di:   
Nuovo argomento   Rispondi    Indice del forum -> Linguaggi per Internet Tutti i fusi orari sono GMT + 2 ore
Pagina 1 di 1

 
Vai a:  
Non puoi inserire nuovi argomenti
Non puoi rispondere a nessun argomento
Non puoi modificare i tuoi messaggi
Non puoi cancellare i tuoi messaggi
Non puoi votare nei sondaggi