Jump to content

greengo

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

greengo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi, I made this function that should print the width and height of all the images in a given folder but when I use the function @ImageCreateFromJpeg() it loops once and then stops. do u know y? <?php function createFile($dir_photo) { $dir = opendir($dir_photo); //List files in images directory while (($file = readdir($dir)) !== false) { $ext = substr($file,strlen($file)-3); $ext = strtolower($ext); if($ext=="jpg") { $img = @ImageCreateFromJpeg( $dir_photo.$file ); $width = ImageSX($img); $height = ImageSY($img); echo $width."-".$height."</br>"; //echo $dir_photo.$file."</br>"; } } closedir($dir_photo); } createFile("photo/"); ?>
  2. this's the function <?php function createFile($dir_photo) { $dir = opendir($dir_photo); //List files in images directory while (($file = readdir($dir)) !== false) { $ext = substr($file,strlen($file)-3); $ext = strtolower($ext); if($ext=="jpg") { $img = @imagecreatefromjpeg( $dir_photo.$file )or die ( E_ERROR ()); $width = ImageSX($img); $height = ImageSY( $img ); echo $width."-".$height; //echo $dir_photo.$file."</br>"; } } } createFile("photo/"); ?>
  3. i'm sure u did though I need to know what that error means
  4. hi everyone, I have this error "1296-972" from this line "$img = @imageCreateFromJPEG( $dir_photo.$file )or die ( E_ERROR ());" does anyone know what it means? thanks
  5. hi, I'm trying to make an application that makes thumbnails but I can't make it work and i doesn't give me any error in return not even in the log file. Can anyone help me? thank <?php function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth ) { // open the directory $dir = opendir( $pathToImages ); // loop through it, looking for any/all JPG files: while (false !== ($fname = readdir( $dir ))) { // parse path for the extension $info = pathinfo("$pathToImage/$fname"); // continue only if this is a JPEG image if ($info['extension'] == 'jpg') { // load image and get image size $img = @imageCreateFromJPEG( "$pathToImages/$fname" ) or die ("Cannot Initialize new GD image stream1"); $width = ImageSX($img); $height = ImageSY( $img ); // calculate thumbnail size $new_width = $thumbWidth; $new_height = floor( $height * ( "$thumbWidth/$width" ) ); // create a new temporary image $tmp_img = @ImageCreateTrueColor( $new_width, $new_height ) or die("Cannot Initialize new GD image stream2"); // copy and resize old image into new image imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // save thumbnail into a file imagejpeg( $tmp_img, "$pathToThumbs/$fname" ); } } // close the directory closedir( $dir ); } // call createThumb function and pass to it as parameters the path // to the directory that contains images, the path to the directory // in which thumbnails will be placed and the thumbnail's width. // We are assuming that the path will be a relative path working // both in the filesystem, and through the web for links createThumbs('photo','photo/thumbs',100); function createGallery( $pathToImages, $pathToThumbs ) { //echo "Creating photo_fulvio.html <br />"; $output = "<html>"; $output .= "<head><title>PHOTO_FULVIO</title></head>"; $output .= "<body>"; $output .= "<table width='500' border='0' align='center'>"; $output .= "<tr>"; $output .= "<td><div align='center'>"; $output .= "<h2><font color='#99CC00' face='Arial, Helvetica, sans-serif'><strong>FULVIO'S PHOTO</strong></font></h2>"; $output .= "</div></td>"; $output .= "</tr>"; $output .= "</table>"; $output .= "<table width='500' align='center' border='1'>"; $output .= "<tr>"; // open the directory $dir = opendir( $pathToThumbs ); $counter = 0; // loop through the directory while (false !== ($fname = readdir($dir))) { // strip the . and .. entries out if ($fname != '.' && $fname != '..') { $output .= "<td align='center' align='center' valign='bottom'><a href='$pathToImages/$fname'>"; $output .= "<img src='$pathToThumbs/$fname' border='0'><br><font color='black' face='Arial, Helvetica, sans-serif' size='2'>$fname</font>"; $output .= "</a></td>"; $counter += 1; if ( $counter % 4 == 0 ) { $output .= "</tr><tr>"; } } } // close the directory closedir( $dir ); $output .= "</tr>"; $output .= "</table>"; $output .= "</body>"; $output .= "</html>"; // open the file $fhandle = fopen( "photo_fulvio.php", "w" ); // write the contents of the $output variable to the file fwrite( $fhandle, $output ); // close the file fclose( $fhandle ); } // call createGallery function and pass to it as parameters the path // to the directory that contains images and the path to the directory // in which thumbnails will be placed. We are assuming that // the path will be a relative path working // both in the filesystem, and through the web for links createGallery("photo","photo/thumbs/"); //redirect to the created page header( 'Location: http://localhost/greengo/fulvio/photo_fulvio.php') ; ?>
  6. do u think it is possible do the same code without using a txt file but just an array to store the data?
  7. don't put the db's name in the query to create the table
  8. It points to a file that exists. ok, the function that i'm creating should take images from a folder, make thumbnails of those photos, save 'em in another folder and create a page to show the thumbnails. Everything works, the file and the thumbnails have been created but I still have that error and the header() doesn't work. I can show you the code if you want.
  9. Hi, can anyone tell me y it gives me this error? thanks error Notice: Undefined index: extension in c:\easyphp1-8\www\greengo\fulvio\index.php on line 12 Warning: Cannot modify header information - headers already sent by (output started at c:\easyphp1-8\www\greengo\fulvio\index.php:12) in c:\easyphp1-8\www\greengo\fulvio\index.php on line 107 codie // parse path for the extension $info = pathinfo($pathToImages.$fname); // continue only if this is a JPEG image if ( strtolower($info['extension']) == 'jpg')
  10. I have got a web site that has to upload different css and banners when someone opens it from different website. So I have to make a script that says when user connect from google do this when from ..... do something else.
  11. hi, I wanna make a script that does different things if it's open from different website. Does anyone know where I can start from? thanks
  12. no it just returns echo"got data"; and then nothing.
×
×
  • 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.