Jump to content

resize and crop photos from directory


paparanch

Recommended Posts

hellow world!  :)

i tried hard not to come here and ask for help to prove something to myself, but i just can't do this.  :-[

 

here is the situation:

actually i saw a lot of tutorials regarding resizing and croping photos using php, but most of them were done during uploading process...in my case i wanted to display images from a certain directory that are cropped and resized ON THE FLY...so meaning there is no thumbnail image that correspond to its large image...something like that...

 

to make things more clear, i have big images from "myphotos" folder and i wanted to display it in the browser already cropped and resized proportionally...so here is my code so far...it only display images from my folder....

 

<?


$p_cat = $row['project_name'];

$handle = opendir('portfolio/'.$p_cat.'/');

if($handle) {
  while(false !== ($file = readdir($handle))) {

    if(preg_match("/\w+(.jpg)/",$file)) {
             echo "<div class='update_pics_frame'>";
   echo "<div class='update_pics'>";
      echo "<a class='mb' id='mb1' title='$event_name_formatted' href='/arcke/portfolio/".$row['project_name']."/$file'>";
	echo "<img src='/arcke/portfolio/".$row['project_name']."/$file'>";
      echo "</a>";
  echo "</div>";
echo "</div>";
    }

  }
closedir($handle);
}


?>

 

tnx in advanced gurus!

 

Link to comment
https://forums.phpfreaks.com/topic/151611-resize-and-crop-photos-from-directory/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.