SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 29
  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Photogallery tutorial [PROBLEM]

    Build An Automated PHP Gallery System In Minutes SitePoint


    I have a problem that when I upload a picture it uploads perfectly but there is error

    Notice: Undefined offset: 5 in C:\Users\Mshan\Downloads\Compressed\USBWebserver v8_en\root\gallery\upload.php on line 34

    line 34 is

    if($photos_uploaded['size'][$counter] > 0)


    what should I do for this????



  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Welcome to the SP forums.

    Can you post more code?
    And try to do a print_r($photos_uploaded); just before that if

  3. #3
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
        
    include("config.inc.php");

        
    // initialization
        
    $result_final "";
        
    $counter 0;

        
    // 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'
                        
    );

        
    // Fetch the photo array sent by preupload.php
        
    $photos_uploaded $_FILES['photo_filename'];

        
    // Fetch the photo caption array
        
    $photo_caption $_POST['photo_caption'];

        while( 
    $counter <= count($photos_uploaded) )
        {

            if(
    $photos_uploaded['size'][$counter] > 0)

            {
                if(!
    array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))  
       
                { 
                    
    $result_final .= "File ".($counter+1)." is not a photo<br />";
                }else{
                    
                    
    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 photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );

                    
    // Store the orignal file
                    
    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;
                        
    $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];
                    
    $function_to_read "ImageCreateFrom".$function_suffix;
                    
    $function_to_write "Image".$function_suffix;

                    
    // Read the source file
                    
    $source_handle $function_to_read $images_dir."/".$filename ); 
                    
                    if(
    $source_handle)
                    {
                        
    // Let's create an blank image for the thumbnail
                             
    $destination_handle ImageCreate $thumbnail_width$thumbnail_height );
                    
                        
    // Now we resize it
                          
    ImageCopyResized$destination_handle$source_handle0000$thumbnail_width$thumbnail_height$size[0], $size[1] );
                    }

                    
    // Let's save the thumbnail
                    
    $function_to_write$destination_handle$images_dir."/tb_".$filename );
                    
    ImageDestroy($destination_handle );
                    
    //

                    
    $result_final .= "<img src='".$images_dir"/tb_".$filename."' /> File ".($counter+1)." Added<br />";
                }
            }
        
    $counter++;
        }

        
    // Print Result
    ?>

    <html>
    <head>
        <title>Photos uploaded</title>
    </head>
    <body>
    <?php     echo $result_final;?>
    </body>
    </html>


    here is my whole code
    Last edited by guido2004; Sep 9, 2011 at 01:51. Reason: added php code tags

  4. #4
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is the TUTORIAL Build An Automated PHP Gallery System In Minutes SitePoint I didnt change a single thing but I just PREUPLOAD.PHP because there are some problems

    PHP Code:
    <?php  
      
    include 'config.inc.php';  
      
      
    // initialization  
      
    $photo_upload_fields '';  
      
    $counter 1;  
      
      
    // If we want more fields, then use, preupload.php?number_of_fields=20  
      
    $number_of_fields = (isset($_GET['number_of_fields'])) ?  
        (int)(
    $_GET['number_of_fields']) : 5;  
      
          
      
      
    // Lets build the Image Uploading fields  
      
    while($counter <= $number_of_fields) {  
        
    $photo_upload_fields .="  
    <tr><td>  
      Photo {"
    .$counter.":  
     <input name='photo_filename[]'type='file' />  </td></tr>  
    <tr><td>  
      Caption:  <textarea name='photo_caption[]' cols='30'  rows='1'></textarea>  
    </td></tr>  
    "
    ;  
        
    $counter++;  
      }  

      
    // Final Output  
      
    ?>
    <html>  
    <head>  
    <title>Lets upload Photos</title>  
    </head>  
    <body>  

    <!-- CATEGORY CREATING PART-->


    <form name="form" method="post" >
     <table border='0'  align='center' >  
        <tr> <td>Category Name:</td><td>  
    <input type="text" name="name" />
    <input type="submit" name="Submit" value="Submit">
    </td></tr></table>

    </form>



    <!-- CATEGORY CREATING PART-->
    <?php 


    //CATEGORY CREATING PART

    if(isset($_POST['Submit'])){
        
    $name $_POST['name'];    
        
    if (empty(
    $name)) {
    echo(
    'Please Fill the Category <meta http-equiv=Refresh content="2;url="">');

    }else{
        

    // Refresh page 1 time    
    if (!isset($_GET['reload'])) {
    echo 
    '<meta http-equiv=Refresh content="0;url=">';
    }    




        

    $sql="INSERT INTO gallery_category(`category_name`) VALUES('$name')"
    $result=mysql_query($sql);

    // if successfully insert data into database, displays message "Successful".
    if($result){
        

    echo 
    "Successful Category Created";
    }else {
    echo 
    "ERROR";
    }
    }
    }
    ?>






    <form enctype='multipart/form-data'   action='upload.php' method='post'  name='upload_form'>  
      <table  border='0'  align='center'>  
        <tr><td>  
          Select Category  
          
    <select name='category'>


    <?php  

    $result 
    mysql_query('SELECT category_id,category_name FROM gallery_category');  
      while(
    $row mysql_fetch_array($result)) { 
      
       echo 
    "<option value='$row[0]'>$row[1]</option>"
       
        }  
      
    mysql_free_result$result );  
      
       
    ?>
       
       
       
       </select> 
       
        </td></tr>  
        <?php echo  $photo_upload_fields ;?>
        <tr><td>  
          <input type='submit' name='submit'  value='Add Photos' /> 
        
          
          

        </td></tr>  
      </table>  
    </form>  
    </body>  
    </html>  

    <?php echo // close connection
    mysql_close(); ?>
    Last edited by guido2004; Sep 9, 2011 at 01:52. Reason: added php code tags

  5. #5
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    I put some code tags around the code you posted. It makes it easier to read. Please do so next time you have to post code.

    Please add the following lines (indicated in red) to your upload.php, test it, and post the result here.
    Code:
        // Fetch the photo caption array
        $photo_caption = $_POST['photo_caption'];
        echo "photo_caption: "; print_r($photo_caption); echo "<br />";
    
        while( $counter <= count($photos_uploaded) )
        {
            echo "counter: $counter<br />";
            if($photos_uploaded['size'][$counter] > 0)

  6. #6
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    photo_caption: Array ( [0] => [1] => [2] => [3] => [4] => )
    counter: 0
    
    Notice: Undefined offset: 5 in E:\Usb Web Server v7.0\Root\gallery\upload.php on line 37
    File 1 Added

  7. #7
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    I had you echo out the wrong array
    It should have been
    Code:
    echo "photos_uploaded: "; print_r($photos_uploaded ); echo "<br />";
    But anyway, looking at the output you posted, it seems that the error occurs in the first passing of the while loop.
    $counter is 0, and the error says the undefined offset is 5, so the error shouldn't have anything to do with $counter.
    The error is displayed before 'File 1 added', so it must be somewhere in this part of the code:
    PHP Code:
           if($photos_uploaded['size'][$counter] > 0)

            {
                if(!
    array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))  
       
                { 
                    
    $result_final .= "File ".($counter+1)." is not a photo<br />";
                }else{
                    
                    
    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 photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );

                    
    // Store the orignal file
                    
    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;
                        
    $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];
                    
    $function_to_read "ImageCreateFrom".$function_suffix;
                    
    $function_to_write "Image".$function_suffix;

                    
    // Read the source file
                    
    $source_handle $function_to_read $images_dir."/".$filename ); 
                    
                    if(
    $source_handle)
                    {
                        
    // Let's create an blank image for the thumbnail
                             
    $destination_handle ImageCreate $thumbnail_width$thumbnail_height );
                    
                        
    // Now we resize it
                          
    ImageCopyResized$destination_handle$source_handle0000$thumbnail_width$thumbnail_height$size[0], $size[1] );
                    }

                    
    // Let's save the thumbnail
                    
    $function_to_write$destination_handle$images_dir."/tb_".$filename );
                    
    ImageDestroy($destination_handle );
                    
    //

                    
    $result_final .= "<img src='".$images_dir"/tb_".$filename."' /> File ".($counter+1)." Added<br />";
                } 
    I can't see the error right away. Do you mind adding the line I posted at the beginning ($photos_uploaded) and repost the result here?

  8. #8
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is how I added what you gave me early


    Code:
    <?php
    	include("config.inc.php");
    
    	// initialization
    	$result_final = "";
    	$counter = 0;
    
    	// 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'
    					);
    
    	// Fetch the photo array sent by preupload.php
    	$photos_uploaded = $_FILES['photo_filename'];
    
    	// Fetch the photo caption array
    	$photo_caption = $_POST['photo_caption'];
        echo "photo_caption: "; print_r($photo_caption); echo "<br />";
    
     	echo "counter: $counter<br />";
    	while( $counter <= count($photos_uploaded) )
    	{
    
    		if($photos_uploaded['size'][$counter] > 0)
    
    		{
    			if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))  
       
    			{ 
    				$result_final .= "File ".($counter+1)." is not a photo<br />";
    			}else{
    				
    				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 photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );
    
    				// Store the orignal file
    				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;
    					$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];    
    				$function_to_read = 'ImageCreateFrom' . $function_suffix;    
    				$function_to_write = 'Image' . $function_suffix;    
    					
    				// Read the source file    
    				$source_handle = $function_to_read($images_dir . '/' . $filename);    
    							
    				if ($source_handle) {    
    				  // Let's create a blank image for the thumbnail    
    				  $destination_handle =  ImageCreateTrueColor($thumbnail_width, $thumbnail_height);    
    					
    				  // Now we resize it    
    				  ImageCopyResampled($destination_handle, $source_handle,0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1]);    
    				}    
    					
    				// Let's save the thumbnail    
    				$function_to_write($destination_handle, $images_dir . '/tb_' . $filename);
    				ImageDestroy($destination_handle );			
    								
    								
    								$result_final .= "<img src='".$images_dir. "/tb_".$filename."' /> File ".($counter+1)." Added<br />";
    				
    			}
    		}
    	$counter++;
    	}
    
    	// Print Result
    ?>
    
    <html>
    <head>
    	<title>Photos uploaded</title>
    </head>
    <body>
    <?php 	echo $result_final;?>
    </body>
    </html>

  9. #9
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Do it like this (I changed the first echo, and moved the second inside the while loop)
    Code:
      echo "photos_uploaded: "; print_r($photos_uploaded); echo "<br />";
    
      while( $counter <= count($photos_uploaded) )
      {
        echo "counter: $counter<br />";

  10. #10
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    photo_caption: Array ( [0] => [1] => [2] => [3] => [4] => )
    counter: 0
    counter: 1
    counter: 2
    counter: 3
    counter: 4
    counter: 5
    
    Notice: Undefined offset: 5 in E:\Usb Web Server v7.0\Root\gallery\upload.php on line 38
    File 1 Added

  11. #11
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mannn this is a pain in my ass............who made this Build An Automated PHP Gallery System In Minutes SitePoint tutorial -__________-

  12. #12
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You didn't do what I asked you to do. You didn't change the first echo. Just copy and paste it:
    Code:
    echo "photos_uploaded: "; print_r($photos_uploaded); echo "<br />";

  13. #13
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Never mind, this
    Code:
        while( $counter <= count($photos_uploaded) )
    should be
    Code:
        while( $counter < count($photos_uploaded) )

  14. #14
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh now its working perfectly

  15. #15
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Notice: Undefined index: cid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 8

    Notice: Undefined index: pid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 9


    PHP Code:
    <?php
        
    include("config.inc.php");

        
    // initialization
        
    $result_array = array();
        
    $counter 0;

        
    $cid = (int)($_GET['cid']);
        
    $pid = (int)($_GET['pid']);

        
    // Category Listing

        
    if( empty($cid) && empty($pid) )
        {
            
    $number_of_categories_in_row 4;

              
    $result mysql_query("      
        SELECT      
          c.category_id,      
          c.category_name,      
          COUNT(photo_id)      
        FROM      
          gallery_category AS c LEFT JOIN      
          gallery_photos AS p ON      
          p.photo_category = c.category_id      
        GROUP BY c.category_id      
      "
    );
            while( 
    $row mysql_fetch_array$result ) )
            {
                
    $result_array[] = "<a href='viewgallery.php?cid=".$row[0]."'>".$row[1]."</a> "."(".$row[2].")";
            }
            
    mysql_free_result$result );    

            
    $result_final "<tr>\n";

            foreach(
    $result_array as $category_link)
            {
                if(
    $counter == $number_of_categories_in_row)
                {    
                    
    $counter 1;
                    
    $result_final .= "\n</tr>\n<tr>\n";
                }
                else
                
    $counter++;

                
    $result_final .= "\t<td>".$category_link."</td>\n";
            }

            if(
    $counter)
            {
                if(
    $number_of_categories_in_row-$counter)
                
    $result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'>&nbsp;</td>\n";

                
    $result_final .= "</tr>";
            }
        }


        
    // Thumbnail Listing

        
    else if( $cid && empty( $pid ) )
        {
            
    $number_of_thumbs_in_row 5;

            
    $result mysql_query"SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."'" );
            
    $nr mysql_num_rows$result );

            if( empty( 
    $nr ) )
            {
                
    $result_final "\t<tr><td>No Category found</td></tr>\n";
            }
            else
            {
                while( 
    $row mysql_fetch_array$result ) )
                {
                    
    $result_array[] = "<a href='viewgallery.php?cid=$cid&pid=".$row[0]."'><img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' /></a>";
                }
                
    mysql_free_result$result );    

                
    $result_final "<tr>\n";
        
                foreach(
    $result_array as $thumbnail_link)
                {
                    if(
    $counter == $number_of_thumbs_in_row)
                    {    
                        
    $counter 1;
                        
    $result_final .= "\n</tr>\n<tr>\n";
                    }
                    else
                    
    $counter++;

                    
    $result_final .= "\t<td>".$thumbnail_link."</td>\n";
                }
        
                if(
    $counter)
                {
                    if(
    $number_of_photos_in_row-$counter)
                
    $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'>&nbsp;</td>\n";

                    
    $result_final .= "</tr>";
                }
            }
        }

        
    // 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 );    

            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'>Categories</a> &gt; 
                            <a href='viewgallery.php?cid=
    $cid'>$category_name</a></td>\n</tr>\n";

                
    $result_final .= "<tr>\n\t<td align='center'>
                        <br />
                        <img src='"
    .$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' />
                        <br />
                        
    $photo_caption
                        </td>
                        </tr>"
    ;
            }
        }

    // Final Output

    ?>
    <html>
    <head>
        <title>Gallery View</title>
    </head>
    <body>
    <table width='100%' border='0' align='center' style='width: 100%;'>
    <?php echo $result_final?>        
    </table>
    </body>
    </html>

  16. #16
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Oh now its working perfectly
    Arrays start with key value 0, so if an array contains 5 elements, the counter should go from 0 to 4.
    The while loop accepted the value 5 as well (the number of array elements), but there was no key 5. Instead, it should accept all values less than the number of array elements.

  17. #17
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by xmshanx View Post
    Notice: Undefined index: cid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 8

    Notice: Undefined index: pid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 9
    It appears you are not sending cid and pid in the query string. How are you making the call to this script? Through a link?

    And add this to the top of the script:
    PHP Code:
    print_r($_GET); 

  18. #18
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    Array ( )
    NoticeUndefined indexcid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 9

    Notice
    Undefined indexpid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 10 

  19. #19
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it shows only a
    Array ( )

  20. #20
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    How do you run that script? Putting E:\Usb Web Server v7.0\Root\gallery\viewgallery.php in the browser?

    That won't work. It needs values for cid and pid in the query string. For example:
    Code:
    E:\Usb Web Server v7.0\Root\gallery\viewgallery.php?cid=1&pid=1
    I'm sure somewhere in the gallery script you're working on, there's a link to viewgallery.php with cid and pid values.

  21. #21
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    How do you run that script? Putting E:\Usb Web Server v7.0\Root\gallery\viewgallery.php in the browser?

    That won't work. It needs values for cid and pid in the query string. For example:
    Code:
    E:\Usb Web Server v7.0\Root\gallery\viewgallery.php?cid=1&pid=1
    I'm sure somewhere in the gallery script you're working on, there's a link to viewgallery.php with cid and pid values.


    I only have preupload.php and upload.php only when I upload a pictures it shows the uploaded picture and echos a File 1 Added but there is no such link

  22. #22
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Code:
    Notice: Undefined index: cid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 8
    I only have preupload.php and upload.php only
    No you don't. You also have viewgallery.php, otherwise it wouldn't give you that error

    In fact, you should have 5 php files.

    From the page you got the script from:
    Create Direct Links to Categories and Images

    To create direct links from other pages of our site to the categories, we just need to know the Category Id. For example, to link to Category Id = 1 you can use the following URL:

    http://www.yoursite.com/gallery/viewgallery.php?cid=1

    To link up an image, you need to know its Photo Id and as well as its Category Id:

    http://www.yoursite.com/gallery/view...hp?cid=1&pid=1

    The above link will open the Photo Id = 1 if that exists in the Category Id 1.

  23. #23
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Code:
    Notice: Undefined index: cid in E:\Usb Web Server v7.0\Root\gallery\viewgallery.php on line 8
    No you don't. You also have viewgallery.php, otherwise it wouldn't give you that error

    In fact, you should have 5 php files.

    From the page you got the script from:


    sorry yes there is a viewgallery.php but where should I put that links

  24. #24
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Did you read that article you linked to? To me it seems that part of the application isn't there. You have to make a page where you link to viewgallery.php like is explained in the part I quoted.

  25. #25
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But they didn't say to create a different page to link those......viewgallery should work properly there is something wrong in the code did you try the ARCHIVE ???? FULL OF ERRORS sigh


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
  •