<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ridimensionamento immagine]]></title><description><![CDATA[<p dir="auto">Ciao a tutti,</p>
<p dir="auto">volevo fare uno script in javascript che mi permetta di ingrandire e diminuire l'immagine cliccandoci sopra.</p>
<pre><code>function grande(Immagine) {

  var elem = document.getElementById(Immagine);
  elem.width = 200;
   }



&lt;/script&gt;

echo"&lt;img id="Immagine" onClick=grande('Immagine')  src=\"Foto68.jpg\" /&gt;";
</code></pre>
<p dir="auto"><strong>Edit:</strong></p>
<blockquote>
<ul>
<li>Inizia i messaggi con una maiuscola e termina con un punto.</li>
</ul>
</blockquote>
]]></description><link>https://dev.connect.gt/topic/93319/ridimensionamento-immagine</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 19:24:31 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/93319.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Jan 2009 18:03:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ridimensionamento immagine on Wed, 28 Jan 2009 09:16:11 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Edit:</strong></p>
<blockquote>
<ul>
<li>Inizia i messaggi con una maiuscola e termina con un punto.</li>
</ul>
</blockquote>
<pre><code>&lt;html&gt; 
&lt;head&gt; 
&lt;title&gt;image resize&lt;/title&gt; 

&lt;script type="text/javascript"&gt;
var imgState; 
var imgWidth; 
var imgHeight;
imgWidth = 95;


function changeimageSize(thisimage){ 
 
imgWidth = document.getElementById(thisimage).width; 
imgHeight = document.getElementById(thisimage).height;


if(imgWidth == 95){
imgWidth = eval(imgWidth*2); 
imgHeight = eval(imgHeight*2);

document.getElementById(thisimage).width = imgWidth; 
document.getElementById(thisimage).height = imgHeight;


}else{ 
if(imgWidth == 190){
imgWidth = eval(imgWidth/2); 
imgHeight = eval(imgHeight/2);
}


document.getElementById(thisimage).width = imgWidth; 
document.getElementById(thisimage).height = imgHeight;

 
} 
} 
&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt; 

&lt;?
$i=0;
while($i&lt;=10)
{ 

echo"&lt;img src=\"balloons.jpg\" width=\"95\"  border=\"0\" alt=\"\" id=\"firstimage".$i."\" onclick=\"changeimageSize(id)\"&gt;";
$i++;
}
?&gt;
&lt;/body&gt; 
&lt;/html&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/803729</link><guid isPermaLink="true">https://dev.connect.gt/post/803729</guid><dc:creator><![CDATA[kerotan]]></dc:creator><pubDate>Wed, 28 Jan 2009 09:16:11 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 19:09:28 GMT]]></title><description><![CDATA[<p dir="auto">Ciao, anchio sono abbastanza ignorante in js, ma una volta imparata la struttura, tutti i linguaggi vengono facili...<br />
Comunque:<br />
Prima cosa creo un array globale, ossia riconosciuto da ogni funzione e in qualsiasi chiamata.<br />
La funzione add_img non fa altro che aggiungere un altro array come valore nella posizione $i dell'array globale.<br />
A sua volta questo nuovo array-valore tiene 3 argomenti: i primi 2 sono le dimensioni iniziali della singola immagine e il terzo è il valore 'booleano' che distingue se aumentare o diminuire le dimensioni.</p>
<p dir="auto">La funzione change usa l'operatore condizionale:<br />
(espressione)?&lt;true&gt;:&lt;false&gt;; per assegnare le dimensioni o originali o modificate a seconda del flag sopra citato.</p>
<p dir="auto">In php aggiungo le immagini e poi aggiungo uno script che 'inizializza' le singole immagini 'registrandole' nell'array gobale...</p>
]]></description><link>https://dev.connect.gt/post/803723</link><guid isPermaLink="true">https://dev.connect.gt/post/803723</guid><dc:creator><![CDATA[greyfox]]></dc:creator><pubDate>Tue, 27 Jan 2009 19:09:28 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 18:32:56 GMT]]></title><description><![CDATA[<p dir="auto">Perfetto...!!!</p>
<p dir="auto">Essendo alquanto ignorante in materia JS...due righe di spiegazione? <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">GRAZIE</p>
]]></description><link>https://dev.connect.gt/post/803728</link><guid isPermaLink="true">https://dev.connect.gt/post/803728</guid><dc:creator><![CDATA[kerotan]]></dc:creator><pubDate>Tue, 27 Jan 2009 18:32:56 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 17:11:30 GMT]]></title><description><![CDATA[<p dir="auto">Guarda se è quello che vuoi:</p>
<p dir="auto">(è in php adesso)<br />
se dovessero sparire le immagine, riaggiorna e riprova</p>
<p dir="auto">Questo è il source studialo:</p>
<pre><code>&lt;body &gt;

&lt;script&gt;
var _imgArray=new Array();

function add_img(num){
var img=document.getElementById('_img'+num);
_imgArray[num]=new Array();
_imgArray[num][0]=img.height;
_imgArray[num][1]=img.width;
_imgArray[num][3]=1;

}
var _fattore=5;
function change(num){
var img=document.getElementById('_img'+num);
img.height=(_imgArray[num][3]==1)?_imgArray[num][0]*_fattore:_imgArray[num][0];
img.width=(_imgArray[num][3]==1)?_imgArray[num][1]*_fattore:_imgArray[num][1];
_imgArray[num][3]=(_imgArray[num][3]==1)?0:1;
}
&lt;/script&gt;
&lt;?php
echo '&lt;center&gt;';
for($i=0;$i&lt;10;$i++){
echo'&lt;p&gt;&lt;img onclick="javascript:change('.$i.')" id="_img'.$i.'" src="Immagine.png" /&gt;&lt;/p&gt;';
}
echo '&lt;script&gt;
var y=0;
for(y=0;y&lt;10;y++){
add_img(y);
}
&lt;/script&gt;';
echo '&lt;/center&gt;';
?&gt;
&lt;/body&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/803725</link><guid isPermaLink="true">https://dev.connect.gt/post/803725</guid><dc:creator><![CDATA[greyfox]]></dc:creator><pubDate>Tue, 27 Jan 2009 17:11:30 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 16:22:46 GMT]]></title><description><![CDATA[<p dir="auto">Per esempio il php è cosi:</p>
<pre><code>&lt;?php 

$i=1;

while($i&lt;=10)
{ 
echo"&lt;center&gt;&lt;img onclick=\"javascript:change()\" id=\"_img".$i."\" src=\"balloons.jpg\" /&gt;&lt;/center&gt;";
$i++;
}
?&gt;
</code></pre>
<p dir="auto">Il Js come lo dovrei modificare?</p>
]]></description><link>https://dev.connect.gt/post/803727</link><guid isPermaLink="true">https://dev.connect.gt/post/803727</guid><dc:creator><![CDATA[kerotan]]></dc:creator><pubDate>Tue, 27 Jan 2009 16:22:46 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 16:19:59 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Edit:</strong></p>
<blockquote>
<ul>
<li>Inizia i messaggi con una maiuscola e termina con un punto.</li>
</ul>
</blockquote>
]]></description><link>https://dev.connect.gt/post/803721</link><guid isPermaLink="true">https://dev.connect.gt/post/803721</guid><dc:creator><![CDATA[greyfox]]></dc:creator><pubDate>Tue, 27 Jan 2009 16:19:59 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 15:49:25 GMT]]></title><description><![CDATA[<p dir="auto">Sempre il solito discorso tutto dentro un while. <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://dev.connect.gt/post/803726</link><guid isPermaLink="true">https://dev.connect.gt/post/803726</guid><dc:creator><![CDATA[kerotan]]></dc:creator><pubDate>Tue, 27 Jan 2009 15:49:25 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 15:42:49 GMT]]></title><description><![CDATA[<p dir="auto">A si scusa problema mio...<br />
Ora è ok:<br />
[..]</p>
<p dir="auto">Il codice che hai postato fa esattamente cio che fa il mio in diciamo il doppio delle righe se non il triplo.</p>
<p dir="auto">Questo è il mio:</p>
<pre><code>&lt;body onLoad="javascript:init();"&gt;
&lt;center&gt;&lt;img onclick="javascript:change()" id="_img" src="/test/lab/soluzioni/Immagine.png" /&gt;&lt;/center&gt;
&lt;script&gt;

var img=document.getElementById('_img');
var _h0;
var _w0;
var _fattore;
function init(){
_h0=img.height;//style.offsetHeight;
_w0=img.width;
_fattore=10;
}
var flag=true;
function change(){
img.height=(flag)?_h0*_fattore:_h0;
img.width=(flag)?_w0*_fattore:_w0;
flag=!flag;
}
&lt;/script&gt;


&lt;/body&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/803724</link><guid isPermaLink="true">https://dev.connect.gt/post/803724</guid><dc:creator><![CDATA[greyfox]]></dc:creator><pubDate>Tue, 27 Jan 2009 15:42:49 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 15:02:08 GMT]]></title><description><![CDATA[<p dir="auto">No ma come questo.</p>
<pre><code>&lt;html&gt; 
&lt;head&gt; 
&lt;title&gt;image resize&lt;/title&gt; 

&lt;script type="text/javascript"&gt;
var imgState; 
var imgWidth; 
var imgHeight;

function imageresize(theimage){ 
imgWidth = document.getElementById(theimage).width; 
imgHeight = document.getElementById(theimage).height;

imgWidth = eval(imgWidth/2); 
imgHeight = eval(imgHeight/2);

document.getElementById(theimage).width = imgWidth; 
document.getElementById(theimage).height = imgHeight;

imgState = 'small'; 
}

function changeimageSize(thisimage){ 
if(imgState == 'small'){ 
imgWidth = document.getElementById(thisimage).width; 
imgHeight = document.getElementById(thisimage).height;

imgWidth = eval(imgWidth*2); 
imgHeight = eval(imgHeight*2);

document.getElementById(thisimage).width = imgWidth; 
document.getElementById(thisimage).height = imgHeight;

imgState = 'large'; 
}else{ 
imgWidth = document.getElementById(thisimage).width; 
imgHeight = document.getElementById(thisimage).height;

imgWidth = eval(imgWidth/2); 
imgHeight = eval(imgHeight/2);

document.getElementById(thisimage).width = imgWidth; 
document.getElementById(thisimage).height = imgHeight;

imgState = 'small'; 
} 
} 
&lt;/script&gt;

&lt;/head&gt;

&lt;body onload="imageresize('firstimage');"&gt; 

&lt;img src="balloons.jpg" width="190"  border="0" alt="" id="firstimage" onclick="changeimageSize(id)"&gt;
</code></pre>
<p dir="auto">cosi clicco sull immagine...se volessi richiamare la funzione da un link?</p>
<pre><code>&lt;a href="#" onclick="changeimageSize('firstimage')" &gt;Cambia&lt;/a&gt;
</code></pre>
<p dir="auto"><img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /><br />
Grazie comunque della disponibilità, ma se io clicco sull'immagine (molto carina tra l'altro <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /> ) mi sparisce (nel tuo script).</p>
<p dir="auto">EDIT:<br />
Se io volessi applicare questo script a più immagini nella solita pagina?? sono sempre alle prese con questi problemi...forse sono duro io a capire.</p>
]]></description><link>https://dev.connect.gt/post/803722</link><guid isPermaLink="true">https://dev.connect.gt/post/803722</guid><dc:creator><![CDATA[kerotan]]></dc:creator><pubDate>Tue, 27 Jan 2009 15:02:08 GMT</pubDate></item><item><title><![CDATA[Reply to ridimensionamento immagine on Tue, 27 Jan 2009 12:21:13 GMT]]></title><description><![CDATA[<p dir="auto">Ciao kerotan se è questo che vuoi:<br />
[..]</p>
<p dir="auto">Questa è la soluzione:</p>
<pre><code>&lt;center&gt;&lt;img onclick="javascript:change()" id="_img" src="Immagine.png" /&gt;&lt;/center&gt;

&lt;script&gt;

var img=document.getElementById('_img');
var _h0=img.height;//style.offsetHeight;
var _w0=img.width;
var _fattore=10;
var flag=true;
function change(){
img.height=(flag)?_h0*_fattore:_h0;
img.width=(flag)?_w0*_fattore:_w0;
flag=!flag;
}
&lt;/script&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/803720</link><guid isPermaLink="true">https://dev.connect.gt/post/803720</guid><dc:creator><![CDATA[greyfox]]></dc:creator><pubDate>Tue, 27 Jan 2009 12:21:13 GMT</pubDate></item></channel></rss>