outermotion Posted February 25, 2009 Share Posted February 25, 2009 hey guys, not a programmer, have a simple project i am trying to implement i have it working sort of,... any help would be greatly appreciated i am trying to crop all images in a folder and display them, but i keep getting line breaks in my images. i know its silly but i am just trying to learn a little something through this. crop.php <?php $w=$_GET['w']; $h=isset($_GET['h'])?$_GET['h']:$w; $x=isset($_GET['x'])?$_GET['x']:0; $y=isset($_GET['y'])?$_GET['y']:0; $filename=$_GET['src']; header('Content-type: image/jpg'); header('Content-Disposition: attachment; filename='.$src); $image = imagecreatefromjpeg($filename); $crop = imagecreatetruecolor($w,$h); imagecopy ( $crop, $image, 0, 0, $x, $y, $w, $h ); imagejpeg($crop); ?> index.php [HIGHLIGHT="PHP"]<link href="style.css" rel="stylesheet" type="text/css" /> <h1>2 pixels. every 5 minutes . dojo desktop workflow experiment</h1> <div id= "wrapper"> <?php $images = "./"; # Location of small versions $cols = 1; # Number of columns to display $thecode = "crop.php?x=0&y=200&w=1600&h=2&src="; if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." ) { $files[] = $file; } } closedir($handle); } $colCtr = 0; foreach($files as $file) { if($colCtr %$cols == 0) echo '<img src="' . $images . $thecode . $file . '" />'; } ?> </div> current output is here, you see the problem there. http://dojo.outermotion.com/workflow thanks in advance Link to comment https://forums.phpfreaks.com/topic/146931-simple-question-about-image-crop/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.