<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ItOpen - Soluzioni WebGIS Open Source &#187; Server Side</title>
	<atom:link href="http://www.itopen.it/category/programmazione/server-side/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itopen.it</link>
	<description>[lang_en]Open Web Solutions: WebGis, Open Source development[/lang_en][lang_it]Soluzioni WebGIS e sviluppo software Open Source[lang_it]</description>
	<lastBuildDate>Tue, 27 Jul 2010 19:07:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Il nuovo sito accessibile del Comune di Filago</title>
		<link>http://www.itopen.it/2007/05/11/il-nuovo-sito-accessibile-del-comune-di-filago/</link>
		<comments>http://www.itopen.it/2007/05/11/il-nuovo-sito-accessibile-del-comune-di-filago/#comments</comments>
		<pubDate>Fri, 11 May 2007 11:17:46 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Realizzazioni]]></category>
		<category><![CDATA[Server Side]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/05/11/il-nuovo-sito-accessibile-del-comune-di-filago/</guid>
		<description><![CDATA[ItOpen realizza il sito internet del Comune di Filago Il nuovo sito del comune di Filago è stato realizzato con il CMS (Content Management System) Joomla FAP. &#160; Il progetto Joomla FAP consiste in una versione accessibile e tradotta in italiano del noto CMS Joomla, abbiamo lavorato per completare Joomla FAP rendendolo conforme alla legge [...]]]></description>
			<content:encoded><![CDATA[<h2 align="left">ItOpen realizza il sito internet del Comune di Filago</h2>
<h2 align="left"><a href="http://www.itopen.it/wp-content/uploads/2007/05/filago_mini.png" onclick="return false;" title="Link diretto al file"><img src="http://www.itopen.it/wp-content/uploads/2007/05/filago_mini.png" alt="Home Page del sito del Comune di Filago" align="right" /></a></h2>
<p style="text-align: left">Il nuovo sito del comune di Filago è stato realizzato con il CMS (Content Management System)  Joomla FAP.</p>
<p style="text-align: right">&nbsp;</p>
<p style="text-align: left"> Il progetto Joomla FAP consiste in una versione accessibile e tradotta in italiano del noto CMS Joomla, abbiamo lavorato per completare Joomla FAP rendendolo conforme alla legge italiana sull&#8217;accessibilità dei siti internet destinati alle pubbliche amministrazioni.</p>
<p style="text-align: left">Il risultato è un CMS pienamente conforme per quanto riguarda la parte disponibile al pubblico e parte del pannello di controllo limitatamente all&#8217;inserimento dei contenuti.</p>
<p style="text-align: left">Il sito del Comune di filago è disponibile qui: <a href="http://www.comune.filago.bg.it" title="Comune di Filago - Home page" target="_blank">http://www.comune.filago.bg.it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/05/11/il-nuovo-sito-accessibile-del-comune-di-filago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla FAP: il CMS conforme alle norme sulla accessibilità Parte 2</title>
		<link>http://www.itopen.it/2007/04/23/joomla-fap-il-cms-conforme-alle-norme-sulla-accessibilita-parte-2/</link>
		<comments>http://www.itopen.it/2007/04/23/joomla-fap-il-cms-conforme-alle-norme-sulla-accessibilita-parte-2/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 11:42:03 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=91</guid>
		<description><![CDATA[Continua l'articolo sulla versione accessibile di Joomla sulla quale abbiamo lavorato.]]></description>
			<content:encoded><![CDATA[<p>Questa è la seconda parte dell&#8217;articolo:<a href="http://www.itopen.it/2007/04/18/joomlafap-il-cms-conforme-alle-norme-sulla-accessibilita/">leggi la prima parte.</a></p>
<h2>Come rendere accessibile Joomla</h2>
<p>Il lavoro di &#8220;trasformazione&#8221; di Joomla è stato portato avanti su un doppio binario:</p>
<ul>
<li>preparare un template accessibile</li>
<li>modificare il core (il nucleo) di Joomla per rimuovere il codice inaccessibile</li>
</ul>
<p>In entrambi i casi il lavoro è partito dalla prima versione di Joomla FAP, dove era già stato preparato un template accessibile (anche se non conforme al XHTML strict come richiesto dalla legge Stanca) e il core era già stato parzialmente adattato.<br />
Il lavoro sul template è stato probabilmente il meno oneroso, in termini di tempo e difficoltà tecniche. Molto più difficile è stato rimuovere dal core tutti i frammenti di codice non conforme,  e in questo non ci è venuto in aiuto il codice di  Joomla, che risente di vistosi errori progettuali che mischiano business logic e layout a  frammenti di codice HTML.<br />
Il core è stato modificato in diversi punti, sopratutto nel modulo com_content, responsabile della generazione delle pagine degli articoli, dal quale sono state rimosse tutte le tabelle inutili sostituendole con dei tag &#8220;div&#8221;.</p>
<p>Parecchie modifiche sono state anche fatte all&#8217;interno dei tag: molti attributi sono infatti deprecati in XHTML strict e hanno reso necessario lo spostamento degli stessi all&#8217;interno di stili inline, laddove possibile.</p>
<h2>Il lavoro continua sui componenti</h2>
<p>Quello che rende Joomla uno dei CMS più utilizzati al mondo è la grande disponibilità di moduli e componenti di terze parti che ne aumentano le funzionalità, alcuni di questi moduli sono assolutamente indispensabili per un moderno CMS (per es. forum e newsletter).<br />
Il lavoro è quindi continuato su alcuni dei principali moduli per renderli anch&#8217;essi accessibli.</p>
<h2>Come validare l&#8217;input degli utenti</h2>
<p>Avere un core e un template accessibili purtroppo non basta: se infatti gli utenti che inseriscono i contenuti non sono vincolati quanto meno al rispetto formale della sintassi del codice XHTML strict, i contenuti da essi inseriti possono invalidare tutto il sito.<br />
Abbiamo quindi modificato in più punti l&#8217;editor wysiwyg di Joomla TinyMCE in modo da costringerlo a produrre nei limiti del possibile del codice XHTML strict.<br />
Questo ha comportato la rinuncia all&#8217;attributo target nei link, che permette di aprire i collegamenti in una nuova finestra. Tralasciando le diatribe e le perplessità sul merito  dell&#8217;argomento, questo problema rimane un punto da risolvere, e i mezzi tecnici (facendo ricorso a codice javascript) non mancherebbero.</p>
<h2>Conclusioni</h2>
<p>Joomla FAP in questa nuova versione rappresenta una ulteriore passo avanti verso un CMS open source ricco di funzionalità, tradotto completamente in italiano e ragionevolmente conforme alla normativa italiana sull&#8217;accessibiltà dei siti internet, almeno per quanto riguarda la parte accessibile al pubblico (front-end).<br />
Rimangono alcuni problemi da risolvere e sicuramente molti bug da sistemare, così come  un adeguamento del pannello di amministrazione (il back-end) sarebbe sicuramente auspicabile.<br />
Siamo ovviamente disponibili per qualsiasi servizio di installazione e configurazione nonchè per la creazione di moduli e componenti.</p>
<h2>Download</h2>
<p>Il codice è ospitato sul forge ufficiale di Joomla e scaricabile tramite svn:</p>
<p><code lang="bash">svn checkout http://joomlacode.org/svn/joomlafap</code><br />
Non siamo noi gli amministratori del progetto, per istruzioni su come scaricarlo e installarlo, fate riferimento al sito:</p>
<p><a href="http://forum.joomla.it/index.php?topic=19236.0">Joomla.it</a></p>
<h2>Supporto commerciale</h2>
<p>Siamo disponibili a fornire supporto commerciale su Joomla FAP per:</p>
<ul>
<li>installazione</li>
<li>configurazione e personalizzazione</li>
<li>creazione moduli e componenti ad hoc</li>
<li>training</li>
<li>creazione di temi grafici accessibili</li>
</ul>
<p><a href="http://www.itopen.it/contatti/" title="Contatti">Contattateci</a> per un preventivo gratuito!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/04/23/joomla-fap-il-cms-conforme-alle-norme-sulla-accessibilita-parte-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Joomla FAP: il CMS conforme alle norme sulla accessibilità</title>
		<link>http://www.itopen.it/2007/04/18/joomlafap-il-cms-conforme-alle-norme-sulla-accessibilita/</link>
		<comments>http://www.itopen.it/2007/04/18/joomlafap-il-cms-conforme-alle-norme-sulla-accessibilita/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 12:27:16 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=89</guid>
		<description><![CDATA[Joomla FAP è una versione di Joomla localizzata in italiano e pesantemente modificata per essere conforme alla legge Stanca sull'accessibilità dei siti web.]]></description>
			<content:encoded><![CDATA[<h2>Un CMS Open Source di livello Enterprise</h2>
<p>Chi non ha mai sentito parlare di Joomla?<br />
<img src="http://www.itopen.it/wp-content/fap.png" align="right" /></p>
<p>Si tratta sicuramente di uno dei piú diffusi CMS open source, forse proprio il piú diffuso, se considerato insieme al suo cugino Mambo.</p>
<p>Purtroppo lo sviluppo di Joomla procede abbastanza lentamente, vista la mole del progetto, e questa lentezza causa non poche difficoltá a chi, come noi in Italia, é costretto ad inseguire le trovate di fantasiosi (e spesso incompetenti) legislatori.</p>
<h2>Le pubbliche amministrazioni e l&#8217;accessibilitá</h2>
<p>Mi riferisco alla legge sull&#8217;accessibilitá dei siti web, nota come legge &#8220;Stanca&#8221; dal nome <del datetime="20070416">dell&#8217;incompetente</del> del legislatore di turno.</p>
<p>La legge, ha avuto l&#8217;innegabile merito di obbligare i creatori di siti web che realizzano siti  e applicazioni per le pubbliche amministrazioni al rispetto di una serie di regole tese a favorire l&#8217;accesso al web da parte delle persone disabili.</p>
<p>Alcune di queste regole fanno parte del bagaglio di buone pratiche comune a qualsiasi serio professionista del settore e si rifanno a norme internazionali note da diverso tempo ed elaborate da enti prestigiosissimi come il W3C, altre sono invece frutto del tentativo di giustificare l&#8217;esistenza di qualche burosauro ministeriale.</p>
<h2>Basta cantinari!</h2>
<p>Il rispetto di queste norme ha il grande pregio di tagliare automaticamente fuori dal mercato tutti i siti fatti da &#8220;l&#8217;amico dell&#8217;amico&#8221; che hanno infestato per anni il web italiano.</p>
<p>Ormai chiunque puó diventare un web publisher semplicemente aprendosi un blog su uno dei tanti fornitori gratuiti, senza doversi preoccupare dei dettagli tecnici, mentre per le applicazioni piú complesse e i progetti di un certo rilievo, la strada rimane aperta solo per i professionisti del settore.</p>
<h2>Joomla e l&#8217;accessibilitá</h2>
<p>Come dicevo poc&#8217;anzi, Joomla soffre il fatto di essere un progetto maturo, nato in tempi in cui l&#8217;accessibilitá non era ancora in cima alle prioritá degli sviluppatori,  l&#8217;adeguamento del codice procede a ritmi serrati ma segue le norme e gli standard internazionali e non quelle partorite dalla fervida immaginazione dei nostri geniali tecnocrati.</p>
<p>Se a ció si aggiunge che il codice di Joomla non consente purtroppo una separazione chiara tra business logic e application logic o peggio tra contenuti e presentazione degli stessi, é facile prevedere come passerá probabilmente parecchia acqua sotto i ponti prima che una versione aggiornata di Joomla conforme alla legge &#8220;Stanca&#8221; sia disponibile in lingua italiana.</p>
<h2>La risposta italiana: Joomla FAP</h2>
<p>Un gruppo di programmatori italiani riuniti nel sito <a href="http://www.joomla.it">joomla.it</a> ha quindi intrapreso l&#8217;arduo compito di rendere conforme alla legge &#8220;Stanca&#8221; la versione italiana di Joomla. Da questi sforzi è nato il progetto Joomla FAP (joomla for all people), che però è stato più o meno abbandonato dopo avere comunque fatto dei notevoli passi avanti.</p>
<p><a href="http://www.itopen.it/2007/04/23/joomla-fap-il-cms-conforme-alle-norme-sulla-accessibilita-parte-2/">Segue&#8230;.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/04/18/joomlafap-il-cms-conforme-alle-norme-sulla-accessibilita/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>On the fly thumbnails generation with PHP</title>
		<link>http://www.itopen.it/2006/02/03/on-the-fly-thumbnails-generation-php/</link>
		<comments>http://www.itopen.it/2006/02/03/on-the-fly-thumbnails-generation-php/#comments</comments>
		<pubDate>Fri, 03 Feb 2006 08:35:46 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=46</guid>
		<description><![CDATA[Learn how to save disk space (and waste CPU time) by generating image thumbnails on the fly with PHP and GD libraries.]]></description>
			<content:encoded><![CDATA[<h2>Save disk or CPU?</h2>
<p>The answer is easy, since your ISP normally charge for disk space and not for CPU usage, nowaday it&#8217;s the disk space shortage that more freqently happens.</p>
<p>The approach described here, permits you to generate &#8220;on the fly&#8221; all the scaled images you need for your site, just using standard PHP functions as provided from the GD library.</p>
<h2>Before you start</h2>
<p>You should check that your <code>php_info();</code> function output has a section concerning GD: it  should look like this:</p>
<h2><a name="module_gd">gd</a></h2>
<table border="1" cellpadding="3" width="400">
<tr>
<td class="e">GD Support </td>
<td class="v">enabled </td>
</tr>
<tr>
<td class="e">GD Version </td>
<td class="v">2.0 or higher </td>
</tr>
<tr>
<td class="e">FreeType Support </td>
<td class="v">enabled </td>
</tr>
<tr>
<td class="e">FreeType Linkage </td>
<td class="v">with freetype </td>
</tr>
<tr>
<td class="e">FreeType Version </td>
<td class="v">2.1.9 </td>
</tr>
<tr>
<td class="e">GIF Read Support </td>
<td class="v">enabled </td>
</tr>
<tr>
<td class="e">GIF Create Support </td>
<td class="v">enabled </td>
</tr>
<tr>
<td class="e">JPG Support </td>
<td class="v">enabled </td>
</tr>
<tr>
<td class="e">PNG Support </td>
<td class="v">enabled </td>
</tr>
<tr>
<td class="e">WBMP Support </td>
<td class="v">enabled </td>
</tr>
</table>
<p></p>
<p>If you see something similar then you&#8217;re ok, else you should check for your PHP installation or change ISP.</p>
<p>This script was tested under Linux, I don&#8217;t know if it works under other OS&#8217;s (but why should&#8217;nt?)</p>
<h2>The idea</h2>
<p>The idea is quite simple, and is not particularly original (I took some code from other projects), I prepared a flexible script that can both accept parameters via GET or POST requests or read values from already defined variables.</p>
<p>The script can hence works standalone or included from other scripts.</p>
<p>Imagine you have an image that you need to resize on the fly, the image is stored sa <code>images/image1.jpg</code> under your document root, imagine also that the PHP script is called <code>getthumb.php</code> and is stored directly under the document root, to get a resized image 100 px wide you just call this url: <code>http://www.yoursite.com/getthumb.php?width=100&#038;img=image1.jpg</code></p>
<p>you usually want to mantain height/width ratio without distorcing the image, this is why you can specify only one dimension (x or y) and the script will do all the calculations for you.</p>
<p>Of course you can also save the thumbnail to disk, but this is normally accomplished through a calling script, just define the following vars in the calling script:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>param   string  <span style="color: #000088;">$img_path</span> image <span style="color: #990000;">file</span> path<span style="color: #339933;">,</span> relative to this script<span style="color: #339933;">,</span> <span style="color: #b1b100;">if</span> not
 <span style="color: #339933;">*</span>                            set<span style="color: #339933;">,</span> the <span style="color: #990000;">next</span> is checked on GET
 <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>param   string  <span style="color: #000088;">$img</span> urlencoded image <span style="color: #990000;">file</span> path<span style="color: #339933;">,</span> relative to this script
 <span style="color: #339933;">*</span>                      <span style="color: #009900;">&#40;</span>in vncms should be <span style="color: #cc66cc;">2</span> level depth<span style="color: #009900;">&#41;</span>
 <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>param   integer <span style="color: #000088;">$width</span> <span style="color: #990000;">max</span> width
 <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>param   integer <span style="color: #000088;">$height</span> <span style="color: #990000;">max</span> height
 <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>param   string  <span style="color: #000088;">$jpgfilename</span> optional filename to store image in<span style="color: #339933;">,</span> <span style="color: #b1b100;">if</span>
 <span style="color: #339933;">*</span>                            not given<span style="color: #339933;">,</span> image is outputted to the browser</pre></div></div>

</p>
<h2>Finally, the code!</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * @copyright 2005 Alessandro Pasotti 
 * @license GPL
 * @author  Alessandro Pasotti (some source grabbed somewhere)
 *
 * Read an image file and send a scaled thumbnail to the browser
 * default to 150 px width.
 *
 * This file can also be included, in this case, define vars in the calling script
 *
 * @param   string  $img_path image file path, relative to this script, if not
 *                            set, the next is checked on GET
 * @param   string  $img urlencoded image file path, relative to this script
 *                      (in vncms should be 2 level depth)
 * @param   integer $width max width
 * @param   integer $height max height
 * @param   string  $jpgfilename optional filename to store image in, if
 *                            not given, image is outputted to the browser
 *
 *
 * Example calls:
 *
 * getthumb.php?img=../../images/logo.jpg              --&gt; default to max 150 (w or h)
 * getthumb.php?img=../../images/logo.jpg&amp;height=200   --&gt; resize to 200px height
 *
 *
 */</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Constants</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEF_WIDTH'</span><span style="color: #339933;">,</span>     <span style="color: #cc66cc;">150</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// default</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEF_HEIGHT'</span><span style="color: #339933;">,</span>    <span style="color: #cc66cc;">150</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// default</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ALLOWED_WIDTH'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// no tampering: set up a max</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ALLOWED_HEIGHT'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">768</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// no tampering: set up a max</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEF_QUALITY'</span><span style="color: #339933;">,</span>   <span style="color: #cc66cc;">90</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// default quality</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEBUG'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// I put this here to avoid any external dependency</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__clean'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">function</span> __clean<span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #000088;">$len</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$len</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ini_get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gpc_magic_quotes'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">addslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">escapeshellcmd</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$s</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Get image location if not defined elsewhere</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image_path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>  <span style="color: #000088;">$image_path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urldecode</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span>__clean<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'img'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">256</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>       <span style="color: #000088;">$width</span>      <span style="color: #339933;">=</span> __clean<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'width'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>      <span style="color: #000088;">$height</span>     <span style="color: #339933;">=</span> __clean<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'height'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// if both are not defined:</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$width</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> DEF_WIDTH<span style="color: #339933;">;</span>
  <span style="color: #000088;">$height</span><span style="color: #339933;">=</span> DEF_HEIGHT<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$width</span>   <span style="color: #339933;">=</span>  <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span>ALLOWED_WIDTH<span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> ALLOWED_WIDTH<span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span>  <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span>ALLOWED_HEIGHT<span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> ALLOWED_HEIGHT<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'MAX_HEIGHT'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'MAX_WIDTH'</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Load image</span>
<span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imginfo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$imgtype</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imginfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ext</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$image_path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$imgtype</span> <span style="color: #339933;">==</span> IMAGETYPE_JPEG<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">imagecreatefromjpeg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$imgtype</span> <span style="color: #339933;">==</span> IMAGETYPE_PNG<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">imagecreatefrompng</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//echo &quot;IMGEBASE &quot; . IMAGE_BASE . ' path: ' .  $image_path; exit;</span>
<span style="color: #666666; font-style: italic;">// Only if your version of GD includes GIF support</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$imgtype</span> <span style="color: #339933;">==</span> IMAGETYPE_GIF<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">imagecreatefromgif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// If an image was successfully loaded, test the image for size</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Get image size and scale ratio</span>
    <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagesx</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagesy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$scale</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span>MAX_WIDTH<span style="color: #339933;">/</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> MAX_HEIGHT<span style="color: #339933;">/</span><span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEBUG'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #990000;">user_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;thumbnails.php - IMAGE: <span style="color: #006699; font-weight: bold;">$image_path</span>  WIDTH: <span style="color: #006699; font-weight: bold;">$width</span> HEIGHT: <span style="color: #006699; font-weight: bold;">$height</span> SCALE: <span style="color: #006699; font-weight: bold;">$scale</span>&lt;hr /&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// If the image is larger than max shrink it</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$scale</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$new_width</span> <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$scale</span><span style="color: #339933;">*</span><span style="color: #000088;">$width</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$new_height</span> <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$scale</span><span style="color: #339933;">*</span><span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Create a new temporary image</span>
        <span style="color: #000088;">$tmp_img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreatetruecolor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$new_width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$new_height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Copy and resize old image into new image</span>
        <span style="color: #990000;">imagecopyresized</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tmp_img</span><span style="color: #339933;">,</span> <span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
                         <span style="color: #000088;">$new_width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$new_height</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">imagedestroy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp_img</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Create error image if necessary</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$img</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$img</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecreate</span><span style="color: #009900;">&#40;</span>DEF_WIDTH<span style="color: #339933;">,</span> DEF_HEIGHT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">imagecolorallocate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$c2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imagecolorallocate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>DEF_WIDTH<span style="color: #339933;">,</span>DEF_HEIGHT<span style="color: #339933;">,</span><span style="color: #000088;">$c2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">imageline</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span>DEF_WIDTH<span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>DEF_HEIGHT<span style="color: #339933;">,</span><span style="color: #000088;">$c2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$jpgfilename</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Display the image</span>
  <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: image/jpg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">imagejpeg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> DEF_QUALITY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DEBUG'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;thumbnails.php - saving to <span style="color: #006699; font-weight: bold;">$jpgfilename</span>&lt;hr&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #990000;">imagejpeg</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$img</span><span style="color: #339933;">,</span> <span style="color: #000088;">$jpgfilename</span><span style="color: #339933;">,</span> DEF_QUALITY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I hope you find this small script useful, it&#8217;s really very flexible and you can use it freely as you like.</p>
<p>Happy resizing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2006/02/03/on-the-fly-thumbnails-generation-php/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Compilare mapserver WebGis</title>
		<link>http://www.itopen.it/2005/08/14/compilare-mapserver-webgis/</link>
		<comments>http://www.itopen.it/2005/08/14/compilare-mapserver-webgis/#comments</comments>
		<pubDate>Sun, 14 Aug 2005 16:41:30 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Mapserver e mapscript]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2005/08/14/compilare-mapserver-webgis/</guid>
		<description><![CDATA[Compilare mapserver con la maggior parte di funzionalità abilitate non è banale]]></description>
			<content:encoded><![CDATA[<p>Giusto qualche dritta per compilare mapserver/mapscript senza troppi traumi</p>
<p>Per una descrizione dettagliata relativa all&#8217;installazione su una SuSE 10 vedi l&#8217;articolo (in inglese): <a href="http://www.itopen.it/2005/12/21/mapserver-webgis-installation-on-suse-10/">Mapserver webgis installation on SuSE 10</a></p>
<p><b>Prerequisiti</b></p>
<ul>
<li>PHP installato con tutti i file include, a seconda della distribuzione potrebbe essere necessario installare i pacchetti &#8220;devel&#8221;</li>
<li>librerie gdal  latest</li>
<li>librerie libgd latest</li>
<li>librerie proj4 latest (copiare projects.h from /usr/include to /usr/lib !!!!)</li>
<li>librerie ming (ming-0.2a), se si vuole usare l&#8217;esportazione in formato Macromedia Flash</li>
<li>postgis se si vuole salvare i dati geografici in postgresql</li>
</ul>
<p>ed ecco la stringa di compilazione</p>
<p><code><br />
./configure<br />
--with-ming=/downloads/ming-0.2a<br />
--with-wfs<br />
--prefix=/usr<br />
--with-proj=/usr/lib<br />
--includedir=/usr/include<br />
--with-gdal=/usr/local/bin/gdal-config<br />
--with-ogr=/usr/local/bin/gdal-config<br />
--with-php=/usr/local/include/php<br />
--with-mygis=yes<br />
--with-wfsclient<br />
--with-wmsclient<br />
--with-postgis<br />
</code></p>
<p>se non ci sono errori, prosegui con make&#038;&#038;make install</p>
<p>Buona fortuna</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2005/08/14/compilare-mapserver-webgis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5 e PHP4 sulla stessa macchina?</title>
		<link>http://www.itopen.it/2005/08/14/php5-e-php4-sulla-stessa-macchina/</link>
		<comments>http://www.itopen.it/2005/08/14/php5-e-php4-sulla-stessa-macchina/#comments</comments>
		<pubDate>Sun, 14 Aug 2005 15:11:18 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=32</guid>
		<description><![CDATA[Come far convivere le due versioni di PHP sulla stessa macchina.]]></description>
			<content:encoded><![CDATA[<p>Un semplice script permette di passare da una versione all&#8217;altra, ci sono metodi più sofisticati, come eseguire due istanze di apache che ascoltano su due porte diverse e associare a ciascuna istanza una versione di PHP diversa.</p>
<p>
Occorre preparare due file di configurazione diversi sia per apache (httpd.conf) sia per PHP (php.ini).</p>
<p>Nel mio caso ho dovuto anche caricare (dinamicamente da uno script PHP) delle estensioni diverse, quindi il link simbolico.
</p>
<p><code lang="bash"><br />
# switch to php 4<br />
rm /usr/local/lib/php.ini<br />
cp /usr/local/lib/php.ini.php4 /usr/local/lib/php.ini<br />
cp /usr/local/apache2/conf/httpd.conf.php4 /usr/local/apache2/conf/httpd.conf<br />
rm /usr/local/lib/php/extensions/php_mapscript.so<br />
ln -s /usr/local/lib/php/extensions/php_mapscript-php4.so /usr/local/lib/php/extensions/php_mapscript.so<br />
service httpd restart<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2005/08/14/php5-e-php4-sulla-stessa-macchina/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LampoWeb SWF</title>
		<link>http://www.itopen.it/2005/08/14/lampoweb-swf/</link>
		<comments>http://www.itopen.it/2005/08/14/lampoweb-swf/#comments</comments>
		<pubDate>Sun, 14 Aug 2005 12:05:26 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2005/08/14/lampoweb-swf/</guid>
		<description><![CDATA[Una piccola libreria per convertire i tracciati di Gimp 1 in SWFShape da usare con PHP-Ming]]></description>
			<content:encoded><![CDATA[<p>LampoWeb &egrave; una piccola libreria che ho scritto qualche tempo fa in PHP. Raccoglie alcune utili funzioni per convertire i tracciati fatti con la versione 1 di Gimp (la versione 2 usa il formato SVG) in oggetti SWFShape da usare con le estensioni ming di PHP. </p>
<p><a href="http://lampoweb.sourceforge.net/" target="_blank">La home page del progetto LampoWeb</a></p>
<p><a href="http://ming.sourceforge.net/" target="_blank">La home page del progetto ming</a>  </p>
<h2>Code samples</h2>
<p>Questo codice produce la homepage del progetto LampoWeb.<br />
<code lang="php"></p>
<p>< ?php<br />
/**<br />
 * Simple test page for php-ming<br />
 * @author       Alessandro Pasotti<br />
*/</p>
<p>  require "lampoweb.inc";</p>
<p>  $colors['up']         = $colorList['SkyBlue3'];<br />
  $colors['hit']        = $colorList['SkyBlue1'];<br />
  $colors['over']       = $colorList['SkyBlue1'];<br />
  $colors['text']       = $colorList['White'];<br />
  $colors['down']       = $colorList['Firebrick3'];<br />
  $colors['fill1']      = $colorList['Firebrick3'];<br />
  $colors['fill2']      = $colorList['White'];<br />
  $colors['background'] = $colorList['Lavender'];</p>
<p>  $xMax                 = 800;<br />
  $yMax                 = 600;<br />
  $frames               = 200;<br />
  $cp                   = new point($xMax/2,$yMax/2);<br />
  $ul                   = new point(0,0);<br />
  $lr                   = new point($xMax,$yMax);<br />
  $ur                   = new point ($lr->x , $ul->y);<br />
  $ll                   = new point ($ul->x , $lr->y);</p>
<p>  //var_dump ($colors);<br />
  ming_setcubicthreshold(10);</p>
<p>  $myShape              = new SWFShape();<br />
  $myShape->setLine(0,0,0,0);<br />
  $myFill               = $myShape->addFill($colors['fill1']->getDecR(), $colors['fill1']->getDecG(), $colors['fill1']->getDecB());<br />
  $myShape->setRightFill($myFill);</p>
<p>  $myMovie              = new SWFMovie();<br />
  $myMovie->setDimension($xMax,$yMax);<br />
  $myMovie->setBackground($colors['background']->getDecR(), $colors['background']->getDecG(), $colors['background']->getDecB()); // light blue</p>
<p>  $myShape2             = new SWFShape();<br />
  $myShape2->setLine(0,0,0,0);<br />
  $myFill2              = $myShape2->addFill($colors['hit']->getDecR(), $colors['hit']->getDecG(), $colors['hit']->getDecB());<br />
  $myShape2->setRightFill($myFill2);<br />
  vecLoad ('spirale.vec' , &#038;$myShape2 , 1 , $xMax * 0.6);<br />
  $lampoweb             = ShapeRotateAt(&#038;$myShape2, &#038;$myMovie, $cp , -360 , $frames*2);<br />
  $lampoweb->setName('spirale');</p>
<p>  $mySprite             = new SWFSprite();<br />
  vecLoad ('lampoweb.vec' , &#038;$myShape , 1 , $xMax * 0.8);</p>
<p>  for($i=0; $i&lt;9; ++$i){<br />
      $infunc           = $infuncs[$i];<br />
      $instance         = $infunc($mySprite, $myShape , $cp);</p>
<p>      for($j=0; $j&lt;30; ++$j)<br />
        $mySprite->nextFrame();</p>
<p>      $outfunc          = $outfuncs[$i];<br />
      $outfunc($mySprite, $myShape, $instance, $cp );<br />
  }</p>
<p>  $lmp                  = $myMovie->add($mySprite);<br />
  $lmp->setName('lampoweb');</p>
<p>  $dimension            = new point(700,20);<br />
  $point                = new point(50,500);</p>
<p>  $menu[]               = array( 'text' => 'Browse Itopen.net' , 'action' => "getUrl('http://www.itopen.net', '_top');");<br />
  $menu[]               = array( 'text' => 'View Acqualba.it' , 'action' => "getUrl('http://www.acqualba.it', '_top');");<br />
  $menu[]               = array( 'text' => 'Stop' , 'action' => "spirale.stop();lampoweb.stop();");<br />
  $menu[]               = array( 'text' => 'Start' , 'action' => "<br />
              spirale.play();<br />
              lampoweb.play();<br />
              lampoweb._visible = true;</p>
<p>            ");<br />
  $menu[]               = array( 'text' => 'Clear' , 'action' => "lampoweb._visible = false;");</p>
<p>        putSWFHorizontalMenu ($myMovie , $dimension , $point , 0.1 , $menu , "Techno.fdb" ,<br />
             $colors, 'center', 1);</p>
<p>  $myMovie->save('lampoweb.swf');</p>
<p>  $bg                   = $colors['background']->getColor();<br />
  $top                  = < << XXX<br />
    <html><br />
    <head><br />
    </head><br />
    <body bgcolor="#$bg"><br />
      <center><br />
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID=objects WIDTH=$xMax HEIGHT=$yMax><param NAME=movie VALUE="lampoweb.swf"><embed src="lampoweb.swf" WIDTH=$xMax HEIGHT=$yMax TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></param></object><br />
      </center><br />
    </body></p>
<p>XXX;<br />
  echo $top;<br />
?></p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2005/08/14/lampoweb-swf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Docbook toolchain</title>
		<link>http://www.itopen.it/2005/08/14/docbook-toolchain/</link>
		<comments>http://www.itopen.it/2005/08/14/docbook-toolchain/#comments</comments>
		<pubDate>Sun, 14 Aug 2005 10:37:42 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2005/08/14/docbook-toolchain/</guid>
		<description><![CDATA[Docbook è un formato XML per la formattazione semantica di documenti]]></description>
			<content:encoded><![CDATA[<h2>Introduzione</h2>
<p>Docbook è un un formato XML che permette di scrivere testi, anche complessi, e di trasformarli in diversi altri formati, per esempio (X)HTML, PDF, JPEG, RTF ecc.</p>
<p>La trasformazione avviene normalmente in due passaggi: da XML a XSL-FO e da XSL-FO al formato desiderato.</p>
<p>Qualche link utile:</p>
<ul>
<li>
<a HREF="http://www.sagehill.net/docbookxsl/">DocBook XSL: The Complete Guide</a></li>
<li><a HREF="http://www.tldp.org/LDP/LDP-Author-Guide/html/transformations.html" >Transformations</a></li>
<li><a HREF="http://www.docbook.org/tdg/en/html/docbook.html">DocBook</a></li>
<li><a HREF="http://opensource.bureau-cornavin.com/crash-course/index.html">Writing Documentation Using DocBook</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2005/08/14/docbook-toolchain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>htmldoc: conversione di HTML in PDF</title>
		<link>http://www.itopen.it/2005/08/14/htmldoc-conversione-di-html-in-pdf/</link>
		<comments>http://www.itopen.it/2005/08/14/htmldoc-conversione-di-html-in-pdf/#comments</comments>
		<pubDate>Sun, 14 Aug 2005 10:07:05 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Server Side]]></category>

		<guid isPermaLink="false">http://www.itopen.it/?p=29</guid>
		<description><![CDATA[Come convertire documenti HTML in PDF lato server con "htmldoc"]]></description>
			<content:encoded><![CDATA[<h2>Introduzione</h2>
<p>Htmldoc è un programma scritto in C, distribuito con doppia licenza (GPL: solo sorgenti, commerciale: binari e sorgenti con supporto) che permette di convertire documenti html in PDF.</p>
<p>Il programma può funzionare in tre modalità:</p>
<ol>
<li>riga di comando</li>
<li>GUI (windows e Linux)</li>
<li>pipe (comodo per lo scripting lato server)</li>
</ol>
<p><a href="http://freshmeat.net/projects/htmldoc/" target="_blank">Visita il sito web del progetto.</a></p>
<p>Ho fatto qualche esperimento e le prime impressioni sono buone:</p>
<h3>Pregi:</h3>
<ul>
<li>Velocissimo</li>
<li>Open source e gratuito, se lo compili da solo</li>
<li>È possibile specificare header,  footer ed eventuali loghi o immagini di sfondo</li>
<li>Supporta le tabelle innestate (con qualche limitazione)</li>
<li>Supporta l&#8217;allinamento per le immagini in linea, cioè il testo fluisce attorno all&#8217;immagine</li>
</ul>
<h3>Difetti:</h3>
<ul>
<li>Non permette di includere font non standard</li>
<li>Non supporta stili e CSS, però permette di formattare l&#8217;HTML con i vecchi tag FONT e BGCOLOR</li>
<li>Non supporta la ripetizione sulle intestazioni delle tabelle</li>
</ul>
<h2>Installazione e compilazione</h2>
<p>L&#8217;installazione è abbastanza semplice, occorre scaricare i sorgenti, scompattarli e lanciare <code>make</code> seguito da <code>su -c "make install"</code></p>
<h3>Un esempio a riga di comando</h3>
<p><code>echo "&lt;h1&gt;&lt;font color=&quot;red&quot;&gt;Ciao mondo&lt;/font&gt;&lt;/h1&gt;" | htmldoc  --no-compression -t pdf14 --quiet --jpeg --webpage --bodycolor '#aaaaaa' --color - > htmldoc_test.pdf</code></p>
<p><a href="http://www.itopen.it/wp-content/htmldoc_test.pdf">Fai clic qui per vedere il risultato.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2005/08/14/htmldoc-conversione-di-html-in-pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
