title: How to resize images on-the-fly?
body: <p>I just receive a old php site from a shared hosting service, that i need to migrate to a new data center.I came across this:</p>
  
  <p>there is a image resize on-the-fly mechanics, changing the name of the image in the browser changes his size:</p>
  
  <pre><code>if(mysql_num_rows($resultIMG)&gt;0) {
    $lineIMG = mysql_fetch_object($resultIMG);
    echo "&lt;img src=\"../Dev/modules/dGC/images/".htmlspecialchars($lineIMG-&gt;imagem_min)."\" alt=\"\" title=\"\"&gt;&amp;nbsp;";
  }
  </code></pre>
  
  <p>$lineIMG is the object that contains the name of the image, it has 3 properties:</p>
  
  <pre><code>$lineIMG-&gt;image;
  $lineIMG-&gt;image_min;
  $lineIMG-&gt;image_med;
  </code></pre>
  
  <p>Only the $lineIMG->image contains the real name of the image, the other have a prefix before corresponding to the size that we want to resize.</p>
  
  <p>For example:</p>
  
  <p>if the image is called product002.jpg, this function:</p>
  
  <pre><code>htmlspecialchars($lineIMG-&gt;imagem_min)
  </code></pre>
  
  <p>will produce:</p>
  
  <pre><code>min_product002.jpg
  </code></pre>
  
  <p>and if I change the name in the browser to med_product002.jpg, that in response will give me the medium size image. None of the files min_product002.jpg or med_product002.jpg exists in the file system, only the original product002.jpg.</p>
  
  <p>Any idea how this is accomplished </p>
  
  <p>I found <a href="http://sneak.co.nz/projects/img-resizing/" rel="nofollow">this</a> post, explaining how to achieve this by using the mod-rewrite, can this be the mechanics used in my site?</p>
  
  <p>But no script is inclued in my pages, can this be global, since it a shared hosting?</p>