<?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 - Open Web Solutions, WebGis Development &#187; PHP</title>
	<atom:link href="http://www.itopen.it/category/programmazione/php/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>Prima release pubblica per Joomla 1.5 Accessibile</title>
		<link>http://www.itopen.it/2008/04/03/prima-release-pubblica-per-joomla-15-accessibile/</link>
		<comments>http://www.itopen.it/2008/04/03/prima-release-pubblica-per-joomla-15-accessibile/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 16:58:37 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2008/04/03/prima-release-pubblica-per-joomla-15-accessibile/</guid>
		<description><![CDATA[Ho rilasciato oggi la prima versione pubblica del progetto Joomla 1.5 FAP: il CMS conforme alla legge &#8220;Stanca&#8221; sull&#8217;accessibilità degli strumenti informatici. Il progetto consiste in un componente per le accesskey, un template XHTML 1.0 strict e alcune piccole patch al core. Dopo quasi tre mesi di lavoro sono finalmente arrivato a poter pubblicare qualcosa [...]]]></description>
			<content:encoded><![CDATA[<p>Ho rilasciato oggi la prima versione pubblica del progetto Joomla 1.5 FAP: il CMS conforme alla legge &#8220;Stanca&#8221; sull&#8217;accessibilità degli strumenti informatici.</p>
<p>Il progetto consiste in un componente per le accesskey, un template XHTML 1.0 strict e alcune piccole patch al core.</p>
<p>Dopo quasi tre mesi di lavoro sono finalmente arrivato a poter pubblicare qualcosa di utilizzabile da tutti, il nuovo Joomla 1.5 conforme alla normativa italiana sull&#8217;accessibilità è disponibile per il download sotto licenza GNU/AGPL.</p>
<p>Il codice del progetto Joomla 1.5 FAP è scaricabile (previo login) dal sito ufficiale dei progetti Joomla:</p>
<p><a href="http://joomlacode.org/gf/project/joomlafap1_5" target="_blank">http://joomlacode.org/gf/project/joomlafap1_5</a></p>
<p>La documentazione è consultabile anche senza aver fatto il login:</p>
<p><a href="http://joomlacode.org/gf/project/joomlafap1_5/frs/?action=FrsReleaseBrowse&amp;frs_package_id=3544" target="_blank">http://joomlacode.org/gf/project/joomlafap1_5/frs/?action=FrsReleaseBrowse&amp;frs_package_id=3544</a></p>
<p>Per vedere all&#8217;opera questa nuova versione, fate una visita al sito ufficiale del Parco Nord Milano:</p>
<p><a href="http://www.parconord.milano.it">http://www.parconord.milano.it</a></p>
<p>Happy Joomla!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2008/04/03/prima-release-pubblica-per-joomla-15-accessibile/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A restful service for mapfile configuration</title>
		<link>http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/</link>
		<comments>http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 07:15:00 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Mapserver e mapscript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/</guid>
		<description><![CDATA[Several tools exists to help maintaining and configuring mapserver mapfiles. MapStorer is a good example. All of the available tools provide a nice GUI and a storage database adapter.


What seems to be missing at the moment is a restful service. We've started working on a project that could fill this gap.]]></description>
			<content:encoded><![CDATA[<p>Recently, we&#8217;ve been actively working on a restful mapfile configuration service.</p>
<p>The advantages of such a system are those of typical webservice:</p>
<ul>
<li>fully decoupled from the GUI, the GUI could be written in any language that talks REST</li>
<li>plain text mapfiles as the storage system</li>
</ul>
<p>The service is being written in PHP and the RESTFUL part is managed with PHP Tonic library.</p>
<p>A few examples of typical URLs:</p>
<ul>
<li>GET http://www.mymaps.com/maps &#8211; retrieve a list of mapfiles</li>
<li>POST http://www.mymaps.com/maps &#8211; creates a new mapfile with the JSON data passed on post</li>
<li>GET http://www.mymaps.com/maps/my_first_map.json &#8211; retrieve the map data as JSON</li>
<li>GET http://www.mymaps.com/maps/my_first_map.xml &#8211; retrieve the map data as XML</li>
<li>GET http://www.mymaps.com/maps/my_first_map.map &#8211; retrieve the map data as plain text mapfile</li>
<li>PUT http://www.mymaps.com/maps/my_first_map.json &#8211; alter the map with JSON data</li>
<li>PUT http://www.mymaps.com/maps/my_first_map.xml &#8211; alter the map with XML data</li>
<li>GET http://www.mymaps.com/maps/my_first_map.xml/layers &#8211; retrieve the map layers as XML</li>
<li>GET http://www.mymaps.com/maps/my_first_map.xml/layers/my_first_layer &#8211; retrieve the map layer data as XML</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/10/05/a-restful-service-for-mapfile-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla 1.5 accessibility challenge</title>
		<link>http://www.itopen.it/2007/09/04/joomla-15-accessibility-challenge/</link>
		<comments>http://www.itopen.it/2007/09/04/joomla-15-accessibility-challenge/#comments</comments>
		<pubDate>Tue, 04 Sep 2007 07:15:20 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/09/04/joomla-15-accessibility-challenge/</guid>
		<description><![CDATA[Our adventure in Joomla 1.5 (now 1.5RC2) continues, we have taken further steps in the development of a WAI compliant XHTML strict template. Read this article to discover what we have done so far.
]]></description>
			<content:encoded><![CDATA[<h2>Project goals</h2>
<p>With this project, we are trying to create a lightweight fully accessible Joomla! 1.5 template with the following features:</p>
<ul>
<li>Support for multiple skin</li>
<li>Font resizing with on-page controls</li>
<li>Skin switcher with high-contrast skin</li>
<li>Liquid layout with max-width</li>
<li>Table-less design</li>
<li>True CSS separation between layout, typography and skin</li>
<li>XHTML strict W3C validation</li>
<li>Produce XHTML strict code from the WYSIWYG editor</li>
<li>Automatic multicolumn layout (two columns or three depending on the presence of rightbar components)</li>
<li>Access key support</li>
<li>Form labels, fieldsets and semantic markup</li>
<li>Clean minimalistic XHTML code (lightweight)</li>
</ul>
<p style="text-align: center"> <strong>The new template in action, blue skin and high contrast skin</strong><br />
<img src="http://www.itopen.it/wp-content/uploads/2007/09/joomla_accessible_template_double.png" alt="Joomla XHTML Strict Template" style="border: 1px solid #0d324f" /></p>
<h2>Building an accessible template</h2>
<p>The new template override feature available in Joomla! 1.5 allows an easy creation of custom template, we can see an example of such an effort in the Beez template available with the distribution. Unfortunately, this template is not XHTML strict but use the transitional doctype instead.</p>
<p>As discussed in the previous article <a href="http://www.itopen.it/2007/08/30/joomla-15-xhtml-strict-template/">Joomla 1.5 XHTML Strict Template</a>, most of the core components can now be overridden in the template, but a couple of issues remains: some unvalid code snippets that are still produced in the core and the WYSIWYG editor doesn&#8217;t produce valid code that follows the strict doctype. The only solution we have found at the moment is patching the core.</p>
<h2>Patching the core</h2>
<p>Until Joomla! 1.5 release, core patches to implement accessiblity features in Joomla involved a major rewriting of the core, they are now limited to a few files. We have applied a small core patch for the &#8220;img&#8221; tag (image) code generation and a bigger patch to the WYSIWYG editor (mostly javascript cleanup routines).</p>
<p>We feel like another patch will be needed in order to implement accesskey support, but we are still considering if a plugin could be developed instead of patching the core.</p>
<h2>To do</h2>
<p>We have already completed most of the steps listed in the first paragraph. We are still working on fixing some components output in the template and we are exploring the different options for accesskey support.</p>
<p>We will be very happy to hear you opinions and comments about this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/09/04/joomla-15-accessibility-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla 1.5 XHTML Strict Template</title>
		<link>http://www.itopen.it/2007/08/30/joomla-15-xhtml-strict-template/</link>
		<comments>http://www.itopen.it/2007/08/30/joomla-15-xhtml-strict-template/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 15:56:04 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[[lang_it]Accessibilità[/lang_it][lang_en]Accessibility[/lang_en]]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/08/30/joomla-15-xhtml-strict-template/</guid>
		<description><![CDATA[

We are continuing our tests on the latest Joomla 1.5 release. In this short notes you will find some random thoughts from a developer point of view about the new code base and moreover some encouraging results concerning the build of an XHTML Strict template.
]]></description>
			<content:encoded><![CDATA[<h2>Joomla 1.5 news: a huge step forward!</h2>
<p><img src="http://www.itopen.it/wp-content/uploads/2007/08/joomla300px.png" alt="Joomla Logo" style="float: right" />This enthusiasm could seem not justified, but after a deep dive in the code of the new release you will notice that, if compared with the 1.0 branch, Joomla 1.5 is a true revolution.</p>
<p>A few examples:</p>
<ul>
<li>The new code is cleaner and better commented</li>
<li>The overall structure is more Object Oriented</li>
<li>There is a first move towards an MVC design patterns, at least inside the components</li>
<li>You can now build the main template including the blocks (components etc.) through XML-like tags instead of PHP function calls</li>
<li>Overriding default components and modules can be done in the template itself instead of hacking the core</li>
</ul>
<p>The last point in the list above is truly new, and represents alone a good motivation to keep a close eye on this wonderful CMS. Changing XHTML code generation in the previous versions was a real nightmare, the code was composed through hundreds of PHP scripts, and there was not a clear sparation between application logic and presentation.</p>
<p>A really odd thing concerning this first pre-release (1.5RC1) is that the templates automatically includes the javascript framework mootools in the template header. This weights 74KB and seems absolutely unuseful in the front-end, I just hope that this libray will be removed from the template in the final release.</p>
<p>From an accessibility point of view, the possibility to alter the produced XHTML code without directly changing the core (this is stlill only partially true, unfortunately) makes much more easier all the work of eliminating unuseful tables, deprecated attributes and the producion of semantically correct code.</p>
<h2>Producing an Joomla 1.5 accessible template</h2>
<p>We in Italy have a special law about websites for public administrations, it is based on W3C WAI but with some minor &#8220;enhancements&#8221; and modifications.</p>
<p>We have spent a considerable amount of time and resources on <a href="http://www.itopen.it/2007/04/18/joomlafap-il-cms-conforme-alle-norme-sulla-accessibilita/" title="Article about Joomla FAP">Joomla FAP</a> project, a successfull project aimed to produce a XHTML Strict and WAI compliant Joomla 1.0 version for the italian market.</p>
<p>Starting from this experience, we decided to explore the possibilities of achieving he same objectives with Joomla 1.5.</p>
<p>The necessary steps are more or less the same we have done with Joomla FAP:</p>
<ul>
<li>Write a XHTML Strict and WAI compliant template</li>
<li>Rewrite main components code to eliminate tables, deprecated attributes and semantically incorrect code</li>
<li>Patch and reconfigure the WYSIWYG editor to prevent invalid code generation</li>
</ul>
<p>A big difference between older Joomla releases and the new 1.5 is that instead of patching the core of the main components, the most part of this work can be now done inside the template, overriding the views of the single modules.</p>
<p>A couple of unresolved issues remains: some XHTML code fragmenst are still generated through function calls to the core, and in a few cases the generate code contains invalid attributes, in such cases a patch to the core is the only way out.</p>
<h2>Some conclusions&#8230;</h2>
<p>The real good new about our explorations is that after only a few hours of work we have seen this message in the W3C validator:</p>
<p><img src="http://www.itopen.it/wp-content/uploads/2007/08/valid-xhtml-strict.png" alt="Valid XHTML Strict" /></p>
<p>There is still al lot of testing and work to be done before we can affirm that the objective has been reached, but if we compare this first encouraging results with the hundreds of hours that were necessary to achieve a similar objective with Joomla FAP, we can really foresee a bright future for Joomla 1.5.</p>
<p>Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/08/30/joomla-15-xhtml-strict-template/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A mapserver KML bridge</title>
		<link>http://www.itopen.it/2007/07/09/un-ponte-tra-kml-e-mapserver-kml-bridge/</link>
		<comments>http://www.itopen.it/2007/07/09/un-ponte-tra-kml-e-mapserver-kml-bridge/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 16:41:47 +0000</pubDate>
		<dc:creator>Alessandro Pasotti</dc:creator>
				<category><![CDATA[Mapserver e mapscript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WebGis]]></category>

		<guid isPermaLink="false">http://www.itopen.it/2007/07/09/lang_itun-ponte-tra-kml-e-mapserverlang_itlang_ena-mapserver-kml-bridgelang_en/</guid>
		<description><![CDATA[


We are going to finish the writing of a kml server that reads a MapServer mapfile and with minimal or zero configuration can serve vector and raster data in kml format.

At the moment, there is limited support for line and polygon classes and styles, while icons symbols for point layers are fully functioning.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.itopen.it/wp-content/uploads/2007/07/google_earth_kml_raster.png" title="Serving Raster from MapServer WMS in Google Earth"><img src="http://www.itopen.it/wp-content/uploads/2007/07/google_earth_kml_raster.thumbnail.png" alt="Serving Raster from MapServer WMS in Google Earth" align="right" /></a></p>
<p>A simple caching mechanism is also available, since for big vector layers, processing time can be an issue.<br />
Raster layers are supported as network links to WFS MapServer.<br />
Though more testing is required, the server is basically finished and fully functional.</p>
<p><a href="http://www.itopen.it/soluzioni/kml-map-server/">See all the details &gt;&gt;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itopen.it/2007/07/09/un-ponte-tra-kml-e-mapserver-kml-bridge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
	</channel>
</rss>
