Link to home
Start Free TrialLog in
Avatar of PurpleSlade
PurpleSlade

asked on

Resizing an image on the fly??

Hi, I have a site where people can ftp photos to directories.  I have a php script when then traverses the directories and creates links to the photos.  The problem is that some of the files are way too big and on a screen set at a lower resolution, like 800 x 600 the pictures overlap some of  the css styles I have going.  My question is, can I process the files so that a smaller image is created on the fly?  This is my code that generates the image itself:

<?php
      $image = $_GET['img'];   // the image filepath is stored here

      $page_title = 'Photos -- ' . $image;
      include('../nonPHPBBincludes/header.inc');

      echo '<body>';
?>
      <center>
      <div class="bluebottomsilver">
            <img border="0" src="../images/banner.jpg"><br />
      </div>
      <p>&nbsp;</p>
      <img border="0" src="../images/banner4.png">
      <p>&nbsp;</p>


      <a href="../index.html">Home</a>
      <a href="mainimagepage.php">Photos</a>
      <a href="../index.php">Forums</a>
      <a href="../forms/MainRosterForm.php">Roster</a>

<p>&nbsp;</p>


<?php
      echo "<img src='$image'>";  // this is where the image gets displayed.
      echo '<p>&nbsp;</p>';
      echo '<p>&nbsp;</p>';
      echo '</center>';
      echo '</body>';
      echo '</html>';
?>
SOLUTION
Avatar of Autogard
Autogard

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i think the best way is use
<img scr="image" with='80%' height="80%">
or
<img scr="image" with='200' height="200">

So you don't need to create a new resized-image.

Bonmat86.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PurpleSlade
PurpleSlade

ASKER

Thanks all - I think tolgaong and dimakh give me what I'm looking for which is a way to programatically create a new image, whether on the fly or scheduled somewhere.  In the meantime I went ahead and manually resized everything last night, but will use one of these in the future.  Thanks everyone.