SitePoint Sponsor

User Tag List

Page 10 of 31 FirstFirst ... 6789101112131420 ... LastLast
Results 226 to 250 of 767
  1. #226
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    the farney
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with the photo gallery

    I'm in the process of setting up this photo gallery, but I'm getting the following error message: "Fatal error: Call to undefined function: imagegif() in /home/eslbuddy/public_html/perfectportrait/upload.php on line 84".

    Can any of you php gurus help me out?

  2. #227
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    the farney
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with the photo gallery

    I'm in the process of setting up this photo gallery, but I'm getting the following error message: "Fatal error: Call to undefined function: imagegif() in /home/.../upload.php on line 84".

    Can any of you php gurus help me out?

  3. #228
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by farneyboy
    I'm in the process of setting up this photo gallery, but I'm getting the following error message: "Fatal error: Call to undefined function: imagegif() in /home/.../upload.php on line 84".

    Can any of you php gurus help me out?
    Hi. I'm not a php guru but perhaps I can anyway help you.
    Could it be that you tried to upload a .gif image?
    Perhaps in your upload.php file this format is not defined among those to be provided to the GD library in order to process the images or the format is not supported by the library you have.

    If you read Mayank's article you will find a section about "Using the GD library". If you are using the GD library: some versions are supporting GIF some others not.

    I have in mind two possible workarounds (not tried myself):
    1. maybe the gif format is not present in your upload.php file, so you might want to add it to the $known_photo_types and $gd_function_suffix arrays as it was done in Mayank's upload.php:
      PHP Code:
          // List of our known photo types
          
      $known_photo_types = array( 
                              
      'image/pjpeg' => 'jpg',
                              
      'image/jpeg' => 'jpg',
                              
      'image/gif' => 'gif',
                              
      'image/bmp' => 'bmp',
                              
      'image/x-png' => 'png'
                          
      );
          
          
      // GD Function List
          
      $gd_function_suffix = array( 
                              
      'image/pjpeg' => 'JPEG',
                              
      'image/jpeg' => 'JPEG',
                              
      'image/gif' => 'GIF',
                              
      'image/bmp' => 'WBMP',
                              
      'image/x-png' => 'PNG'
                          
      ); 
    2. If you do not want to touch the code (or do not want to find out which graphic library is available):
      use Photoshop (or another graphic program) to convert the image your_image.gif to your_image.jpg


    Well there is most probably a more elegant (or sensible, depending on the way of seeing things) solution than the two above; you could try one of these two workarounds until somebody of the real gurus comes up with a better solution than this.
    Hope this helps!
    Last edited by cla313; Oct 7, 2004 at 03:07. Reason: typo correction
    cla313

  4. #229
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by farneyboy
    I'm in the process of setting up this photo gallery, but I'm getting the following error message: "Fatal error: Call to undefined function: imagegif() in /home/.../upload.php on line 84".

    Can any of you php gurus help me out?
    http://www.sitepoint.com/forums/show...&highlight=gif

    As I have said in the past, you should read the entire thread to see how we got to where we are now. On page 1, there are posts stating that the GD library does not support GIF's anymore.

    The original code has much to be desired as far as functionality goes. Consider downloading the code drewf posted a few pages ago. A complete admin section has been written with add, move delete, and rename functions. This code is a collected effort by Mayank, Noddy, Drewf, and me. (sorry if I left anyone out.)

  5. #230
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey,

    i read throught the thread, and tutial, but i still cant find anything on using GD to change a GIF to a JPEG or PNG or summing it will handel.

    I know they are adding in support, but my code is modded and at the moment it just displays an error. If i knew the code i could insert it to continue with converting a GIF and making a thumbnail.

    Thanks IA for any help

  6. #231
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Infizi
    hey,

    i read throught the thread, and tutial, but i still cant find anything on using GD to change a GIF to a JPEG or PNG or summing it will handel.

    Thanks IA for any help
    PHP Code:
    // List of our known photo types
    $known_photo_types = array(
    'image/pjpeg' => 'jpg',
    'image/jpeg' => 'jpg',
    'image/bmp' => 'bmp',
    'image/x-png' => 'png');
            
    // GD Function Suffix List
    $gd_function_suffix = array(
    'image/pjpeg' => 'JPEG',
    'image/jpeg' => 'JPEG',
    'image/bmp' => 'WBMP',
    'image/x-png' => 'PNG'); 
    leave GIF out of the code. Use photoshop or something to convert Gif's and DO NOT upload them.


  7. #232
    SitePoint Member
    Join Date
    Oct 2004
    Location
    gloucester
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Parse error: parse error in c:\phpdev\www\uploadandresize\tmp4sgsh5gtx5.php on line 16

    Can any one advise why I get this error from this code

    $result = mysql_query('SELECT category_id,category_name FROM gallery_category');
    while($row = mysql_fetch_array($result)) {
    $photo_category_list .= <<<__HTML_END // Line 16
    <option value="$row[0]">$row[1]</option>\n
    __HTML_END;
    }
    mysql_free_result( $result );

  8. #233
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My Gallery

    People said they wanted to see what has been done with this original script.
    Well;

    try this

    www.frenchtrip.infizi.com/view.php

    Thats my basic, Im still working on it, mainly the members side.

    Enjoy and PM me if you need and code snippets that i have used. Im open to helping

  9. #234
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    PGH
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry if this was posted in this thread before, I looked through but couldn't find it.

    I don't need the thumbnail aspet of the gallery. I figured out how to just display text instead of the thumbnails, but the script is still selfgenerating them. What do I need to change/remove in order to stop this from happening?

  10. #235
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    look in upload.php....everything is pretty well documented

  11. #236
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jdane:
    In upload.php. you need to remove the lines from
    $size =
    // Build with GD lib
    .... to .....
    $function_to_write (or around there

    ::::

    For my site, if you would like to have a look at the gallery in more detail you need to be logged in. Also you can checkout all my other stuff. Code if all mine, if u need as said i can post some fo it

    Username : demo Password : demodemo
    Enjoy

  12. #237
    SitePoint Enthusiast drewf's Avatar
    Join Date
    Mar 2002
    Location
    Calgary, AB
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Infizi
    hey,

    i read throught the thread, and tutial, but i still cant find anything on using GD to change a GIF to a JPEG or PNG or summing it will handel.

    I know they are adding in support, but my code is modded and at the moment it just displays an error. If i knew the code i could insert it to continue with converting a GIF and making a thumbnail.

    Thanks IA for any help
    Well boys and girls, as you may or may not know PHP version 4.3.9 DOES indeed have GIF file abilities now! Since August...(where have I been?)Yeehaaw. Ok so maybe I'm the only one excited about this but hey...

    I would reccommend downloading it on your testing environment from www.PHP.net. Don't forget to back up your old php.ini file as reference for the new one. You can generally find this in your C:\windows directory. You also have to replace the dll called php4ts.dll and mine was copied over to the C:\windows\system32 directory. Restart Apache web server and it should display PHP/4.3.9 running...

    Ok so if you want to take the GIF plunge you have to open upload.php. There are two places to add two little lines referring to the GIF extension in the file arrays. Look for something similar to this in this file (at the top of the file) and just add the lines pertaining to GIF. That's it. It will work like a charm! Now remember that your ISP must have version 4.3.9 or higher running for GIF access, or you will get errors! Hope this helps...

    PHP Code:
    // List of our known photo types
    $known_photo_types = array(
    'image/pjpeg' => 'jpg',
    'image/jpeg' => 'jpg',
    'image/gif' => 'gif',
    'image/bmp' => 'bmp',
    'image/x-png' => 'png');
     
    // GD Function Suffix List
    $gd_function_suffix = array(
    'image/pjpeg' => 'JPEG',
    'image/jpeg' => 'JPEG',
    'image/gif' => 'GIF',
    'image/bmp' => 'WBMP',
    'image/x-png' => 'PNG'); 
    Drew

    "The town where I grew up has a zip code of E-I-E-I-O."

  13. #238
    SitePoint Enthusiast drewf's Avatar
    Join Date
    Mar 2002
    Location
    Calgary, AB
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cheazell
    Hi Drew et all.

    I'm having real trouble with the login (index.php) page. I can't seem to login. I've tried commenting out all references to the security file but that hasn't worked. Any suggestions?
    Ya, shutdown your firewall!!! HE HE...no seriously, I use ZoneAlarm Pro with Web Filtering and it kills my sessions and NEVER lets me login. Somehow I have tweaked it so it does work on my own website but does not work on my localhost testing server. I found sessions to be a major pain in the rear until I shut this sucker down...then, POOF, it works!

    Try this first...
    Drew

    "The town where I grew up has a zip code of E-I-E-I-O."

  14. #239
    SitePoint Member
    Join Date
    Oct 2004
    Location
    London
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Only first image being created/written

    Hello - I've been working on this for some time, and am a complete PHP newbie. I have created a DB through PHP admin on a plesk server and have gone to the length of populating it by hand as I for some reason the upload code only wants to create the first thumbnail - 0.jpg.

    You can see the problem here:

    http://www.charlieroff.com/gallery/preupload.php

    If you fill in the fields and submit you get the same thumbnail repeated though the counter increases......it's very disconcerting and is probably a typo but I've been through the code line by line. Has anyone else had similar problems? Also I desperately need sub categories as there are two main categories of prints, which are then subdivided into subject matter.

    Thank you!

    Anna

  15. #240
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Calgary
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by drewf
    Ya, shutdown your firewall!!! HE HE...no seriously, I use ZoneAlarm Pro with Web Filtering and it kills my sessions and NEVER lets me login. Somehow I have tweaked it so it does work on my own website but does not work on my localhost testing server. I found sessions to be a major pain in the rear until I shut this sucker down...then, POOF, it works!

    Try this first...

    I'm not actually running ZA or a local firewall between my desktop and my test server so it should work. I'll look at my php.ini file and the MD5 encryption too.

  16. #241
    SitePoint Enthusiast drewf's Avatar
    Join Date
    Mar 2002
    Location
    Calgary, AB
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Session testing:

    Try these short scripts out to see if your sessions are indeed being created, variables passed and destroyed.

    If these scripts are working then your problems lie within either the database structure or in your coding. Look for typo's, ;'s at the end of lines, etc.
    You may need a session primer too. Unfortunately there are not very many well written tutorials on this subject on the net so I can't point you in the right direction. Hopefully you can find the errors and fix em on your own.

    Here are three simple php pages. Name them as such: index.php, login.php and logout.php

    PHP Code:
    <?php
    //index.php
    ?>
    <title>Login Page</title>
    <form action="login.php" method="post">
      <table width="50%" border="0" align="center" cellpadding="3" cellspacing="3" bgcolor="#000000">
        <tr> 
          <td width="58" valign="middle"> <font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">Username:</font></td>
          <td width="138"> <input type="text" size="10" name="user"></td>
          <td width="53"><font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">Password:</font></td>
          <td width="118"> <input type="password" size="10" name="pass"></td>
          <td width="202"> <input type="submit" name="submit" value="Log In"></td>
        </tr>
      </table>
    </form>
    PHP Code:
    <?php
    //login.php
    // Start the login session
    session_start();
    // Retrieve the 'posted' variables and assign them to session variables 
    $_SESSION['user'] = $_POST['user'];
    $_SESSION['pass'] = $_POST['pass'];
    // Check to see if indeed there are session variables assigned
    if (!$_SESSION['user'] || !$_SESSION['pass']) { 
    // If there are no session variables, we'll redirect them to the login form and kill the process.
    header('Location: index.php'); 
    die();  
    }else{
    // Otherwise, this stuff gets printed out
    echo "Sessions are working! You see? The variables travelled over these two pages.<br><br>";
    echo 
    "The username you entered was: " $_SESSION['user'] . "<br>";
    echo 
    "The password you entered was: " $_SESSION['pass'] . "<br>";
    echo 
    "If you have the session save path uncommented in your PHP.INI file,<br>that path on computer is: ";
    print 
    session_save_path();
    echo 
    "<br><br>Create this folder if it does not exist. Be sure to navigate to this folder to see if indeed a session is created.<br>Resize your Explorer window and browser window so they are both visible. <br>Then press the logout link below. Watch the session dissapear.<br>";
    // Be sure to logout to kill the session. Examine the code on logout.php to see how this is done.
    echo "<a href='logout.php'>Logout</a>"
    }
    ?>
    PHP Code:
    <?PHP
    //logout.php 
    session_start(); 
    session_unset();
    session_destroy(); 
    header('Location: index.php'); 
    ?>
    Drew

    "The town where I grew up has a zip code of E-I-E-I-O."

  17. #242
    SitePoint Member
    Join Date
    Aug 2003
    Location
    California
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this is a great tutorial. I've used it a couple times now and have had no trouble making it fit in with my own style rules and code.

    I'm wondering if anyone knows of a similar tutorial that will do the same thing for an archive of PDF (or other formats) documents? I would like to use something similar to the photo gallery to create this archive, but instead of creating thumbnails, I want to create links out of the filenames so that people can download the files.

    If you can point me towards a good tutorial, I'd appreciate it.

    Thanks in advance!

  18. #243
    SitePoint Member chadf's Avatar
    Join Date
    Oct 2004
    Location
    Tennessee
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a way to link to the next / previous image while viewing a single image? I have included the page count and navigation to subsequent pages in the thumbnail view, but would like to carry over similar functionality while viewing individual images...
    I know this is an old question, but I have just recently added this photo gallery to my site and full-size image navigation is a feature that I wanted as well. I have written a quick and simple solution which is really just a few extra lines added to viewgallery.php.

    Here is the new section for Full Size Image viewing:

    PHP Code:
        // Full Size View of Photo
        
    else if( $pid )
        {
            
    $result mysql_query"SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" );
            list(
    $photo_caption$photo_filename) = mysql_fetch_array$result );
            
    $nr mysql_num_rows$result );
            
    mysql_free_result$result );    

            
    //fill pid_array with sorted pids in current category
            
    $result mysql_query"SELECT photo_id FROM gallery_photos WHERE photo_category='".addslashes($cid)."' ORDER BY photo_id" );
            
    $ct mysql_num_rows$result );    
            while (
    $row mysql_fetch_array($result)) {
                
    $pid_array[] = $row[0];
                 }
            
    mysql_free_result$result );

            if( empty( 
    $nr ) )
            {
                
    $result_final "\t<tr><td>No Photo found</td></tr>\n";
            }
            else
            {
                
    $result mysql_query"SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" );
                list(
    $category_name) = mysql_fetch_array$result );
                
    mysql_free_result$result );    

                
    $result_final .= "<tr>\n\t<td>
                            <a href=viewgallery.php'>Albums</a> &gt; 
                            <a href=viewgallery.php?cid=
    $cid'>$category_name</a><br><br></td>\n</tr>\n";
                
                
    // display previous and next links if more than one photo
                
    if ($ct 1) {
                      
    $key array_search($pid$pid_array);
                      
    $prev $key 1;
                      if (
    $prev 0$prev $ct 1;
                      
    $next $key 1;
                      if (
    $next == $ct$next 0;
                      
    $result_final .= "<tr><td colspan='10'><center>";
                      
    $result_final .= "<a href=viewgallery.php?cid=$cid&pid=".$pid_array[$prev]."'>Previous</a>&nbsp;&nbsp;&nbsp;";
                     
    $result_final .= "(".($key+1)." / ".$ct.")&nbsp;&nbsp;&nbsp;";
                      
    $result_final .= "<a href=viewgallery.php?cid=$cid&pid=".$pid_array[$next]."'>Next</a>";
                     
    $result_final .= "</center></td></tr>";
                }
                            
                
    $result_final .= "<tr>\n\t<td align='center'>
                        <img src='"
    .$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' width='500' />
                        <br />
                        
    $photo_caption
                        </td>
                        </tr>"
    ;
            }
        } 
    I am sorting the photos by photo_id, so you will also want to do the same for the thumbnail listings by changing the mysql query line in the thumbnail listing section to:

    PHP Code:
            $result mysql_query"SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."' ORDER BY photo_id" ); 
    Also, please note that for the time being I am simply limiting all of my full size image widths to 500px directly in the <img> tag.

    The code tests just fine for me, but if anyone finds a problem with it please let me know.

    [Edited:]

    I just saw where someone else already wrote code for this. Oh well. It was a good learning experience. Mine is a little different, so I guess you have 2 choices now.

    Here's the other solution:
    http://www.sitepoint.com/forums/show...&postcount=199

  19. #244
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Tifton, Ga
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with streaming error

    I get the following errors when I try to upload an image. I know it's not the code cause I am using the exact code in the tutorial. I know I have the correct path too... Please help! Dan!

    Here is the url to the preupload http://fairfieldinntifton.com/main/g...preupload2.php
    ------------------------------------------------------------------------

    Warning: copy(/home/fair2/fairfieldtifton-www/photo/77.jpg): failed to open stream: No such file or directory in /home/fair2/fairfieldinntifton-www/main/gallery/admin/upload.php on line 54
    Error copying file!

    Warning: getimagesize(/home/fair2/fairfieldtifton-www/photo/77.jpg): failed to open stream: No such file or directory in /home/fair2/fairfieldinntifton-www/main/gallery/admin/upload.php on line 69

    Warning: Division by zero in /home/fair2/fairfieldinntifton-www/main/gallery/admin/upload.php on line 77

    Warning: imagecreatefromjpeg(/home/fair2/fairfieldtifton-www/photo/77.jpg): failed to open stream: No such file or directory in /home/fair2/fairfieldinntifton-www/main/gallery/admin/upload.php on line 87

    Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/fair2/fairfieldinntifton-www/main/gallery/admin/upload.php on line 99

    Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/fair2/fairfieldinntifton-www/main/gallery/admin/upload.php on line 100
    File 1 Added

  20. #245
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Tifton, Ga
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind it was a path issue

  21. #246
    SitePoint Member
    Join Date
    Oct 2004
    Location
    London
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sub-categorisation - duplicating the code?

    I have managed to iron out a few of the problems that I had posted previously but one of the major tasks is that I need sub categories and when I reiterated a large tranche of the code inorder to do this, nothing is retreived. I'm a total PHP newbie.

    This can be seen below where cid is the category and sid is the sub-category....
    http://www.charlieroff.com/gallery/v...2&sid=2&page=1

    Any pointers appreciated.

  22. #247
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    right,

    basically before you run the script to show the photos, or if you dont want photos, just run a script that connects to your databse, and selects categorys from your cat table., Use cid, cat_name, cat_sub_of

    so, SELECT * FROM cat_table_name WHERE cat_sub_of = 'cid'

    This will grab any sub categorys from the current category.

    then, underneath use the photo display code, plus
    if(isset($sid)){
    //code//
    }

    This should work

  23. #248
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Brisbane
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just thought this might come in handy to some others.

    On my system, when using the gallery as is, I get the message " File 1 is not a image" when uploading PNGs.

    I solved this by adding "'image/png' => 'png'" to both the $known_image_types and $gd_function_suffix arrays like so:
    PHP Code:
    // List of our known image types
    $known_image_types = array( 
        
    'image/pjpeg' => 'jpg',
        
    'image/jpeg' => 'jpg',
        
    'image/gif' => 'gif',
        
    'image/bmp' => 'bmp',
        
    'image/x-png' => 'png',
        
    'image/png' => 'png'
    );

    // GD Function List
    $gd_function_suffix = array( 
        
    'image/pjpeg' => 'JPEG',
        
    'image/jpeg' => 'JPEG',
        
    'image/gif' => 'GIF',
        
    'image/bmp' => 'WBMP',
        
    'image/x-png' => 'PNG',
        
    'image/png' => 'PNG'
    ); 
    This solves the error and gets it working nicely.

  24. #249
    SitePoint Member
    Join Date
    Oct 2004
    Location
    London
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Infizi
    right,

    basically before you run the script to show the photos, or if you dont want photos, just run a script that connects to your databse, and selects categorys from your cat table., Use cid, cat_name, cat_sub_of

    so, SELECT * FROM cat_table_name WHERE cat_sub_of = 'cid'

    This will grab any sub categorys from the current category.

    then, underneath use the photo display code, plus
    if(isset($sid)){
    //code//
    }

    This should work
    I found out the problem I was having was due to a missing bracket...doh...but there is still an issue with image order - to define the order that images appear in is beyond me programming wise, though I have seen it in a non database based gallery. I haven't used the above but do need to refine the code because there's too many if then else statements......

    Any ideas?

    Thank you

  25. #250
    SitePoint Guru
    Join Date
    Nov 2002
    Location
    Dubai
    Posts
    714
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pictures failing to upload-Newbie needs help

    Hi,

    I am quite new to PHP. I am trying to build a photogallery using the tutorial by Mayank. I downloaded the files from the code archives and tried uploading a few photographs. I am trying it out on my PC using the local host. I created a directory called photos and put a few photos in them. Then I tried to upload them by using the file, preupload.php. But it is not getting uploaded. I am getting the following errors.

    Warning: copy(photos/5.jpg) [function.copy]: failed to create stream: No such file or directory in c:\ncdtree\my documents\php\example scripts\photos\upload.php on line 57

    Warning: getimagesize(photos/5.jpg) [function.getimagesize]: failed to create stream: No such file or directory in c:\ncdtree\my documents\php\example scripts\photos\upload.php on line 60

    Warning: Division by zero in c:\ncdtree\my documents\php\example scripts\photos\upload.php on line 68

    Fatal error: Call to undefined function: imagecreatefromjpeg() in c:\ncdtree\my documents\php\example scripts\photos\upload.php on line 78

    I have given below an extract from the code containing the lines mentioned above. When I go to viewgallery.php, I can see the captions but there is only the cross sign in the place where the photos should have been.

    PHP Code:
    mysql_query"INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" );
        
    $new_id mysql_insert_id();
        
    $filetype $photos_uploaded['type'][$counter];
        
    $extention $known_photo_types[$filetype];
        
    $filename $new_id.".".$extention;

        
    mysql_query"UPDATE gallery_photos SET // Line 57 photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );

        
    // Store the original file - This is line 60
        
    copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename);

        
    // Let's get the Thumbnail size
        
    $size GetImageSize$images_dir."/".$filename );
        if(
    $size[0] > $size[1])
        {
         
    $thumbnail_width 100;  // Line 68
         
    $thumbnail_height = (int)(100 $size[1] / $size[0]);
        }
        else
        {
         
    $thumbnail_width = (int)(100 $size[0] / $size[1]);
         
    $thumbnail_height 100;
        }
       
        
    // Build Thumbnail with GD 1.x.x, you can use the other described methods too
        
    $function_suffix $gd_function_suffix[$filetype];  // Line 78
        
    $function_to_read "ImageCreateFrom".$function_suffix;
        
    $function_to_write "Image".$function_suffix

    Where am I going wrong? I have also been reading all the threads posted. Hence, I took care to upload JPEG files instead of GIF files. I read about a similar problem by dk4210 where it turned out to be path problem, he says. But I have saved my photos in the same directory as upload.php and the other files from the code archive. Then what is the problem? Can anyone help a layperson like me?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •