SitePoint Sponsor

User Tag List

Page 18 of 31 FirstFirst ... 814151617181920212228 ... LastLast
Results 426 to 450 of 767
  1. #426
    sean
    SitePoint Community Guest
    Wow, really nice tutorial. And thanks for the additional code spence_noodle, it will really come in handy!

  2. #427
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi All

    I have movedmy image gallery code from an Apache server to an IIS server and it doesn't work anymore.

    I get the following error:

    Warning: copy(../../external/image-library/0.jpg) [function.copy]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\external\admin\image-library.php on line 247

    Warning: getimagesize(../../external/image-library/0.jpg) [function.getimagesize]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\external\admin\image-library.php on line 250

    Warning: Division by zero in c:\Inetpub\wwwroot\external\admin\image-library.php on line 274

    Fatal error: Call to undefined function ImageCreateFromJPEG() in c:\Inetpub\wwwroot\external\admin\image-library.php on line 290

    Line 247 is:

    PHP Code:
    copy($images_uploaded['tmp_name'][$counter], $images_dir."/".$filename); 
    Line 250 is:

    PHP Code:
    $size GetImageSize$images_dir."/".$filename ); 
    Line 274 is:

    PHP Code:
    $thumbnail_width = (int)($Config_tbheight_tall $size[0] / $size[1]); 
    Line 290 is:

    PHP Code:
    $source_handle $function_to_read($images_dir '/' $filename); 
    Any help would be great.

    Thanks

    mrmbarnes

  3. #428
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I m trying to make a search .php

    I m trying to make a search .php so users can search my database and view the results the same way we use in index.php.........
    but the results are poor :'(

    Can any1 Help me????

  4. #429
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Added Subcategory Tree Listing

    I've used the following code:

    PHP Code:
    <?php
            
    include("config.inc.php");
            
            
    // initialization
            
    $cat_array = array();
            
    $counter 0;
        
            
    // Category Listing

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

                    
    $cat mysql_query"SELECT c.category_id,c.category_name,c.category_parent,c.category_des,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 ORDER BY c.category_des ASC" 
    );        
                       
                    while( 
    $row mysql_fetch_array$cat ) )
                    {                        
                        if(
    $row[2] == 0)
                        {                            
                        
    $cat_array[] = "<font face='Verdana, Arial, Helvetica, sans-serif' size='1'><a href='cat_user.php?cid=".$row[0]."'>".$row[1]."</a> "."(".$row[4].")</font><br />";
                        }
                        
                        if(
    $row[2] > 0)
                        {
                        
    $subresult mysql_query("SELECT category_id,category_name,category_parent,category_des FROM gallery_category WHERE category_name='".$row[1]."' ORDER BY category_des ASC");
                                                                
                        while( 
    $sub_result mysql_fetch_array$subresult ) )
                        {                                                                                                                                                
                            if (
    $sub_result[2] !=''
                            {
                                
    $line1 explode('/'$sub_result[3]);
                                
                                
    $line2 implode(', '$line1);
                                
                                
    $words1 preg_replace('/\s+/'''$line2);
                                
                                
    $words2 str_replace(','' '$words1);
                                                    
                                
    $level substr_count($words2," ");
                            
                                if(
    $level == 1)
                                {
                                    
    $add str_repeat('&nbsp;'0);
                                }
                                
                                if(
    $level == 2)
                                {
                                    
    $add str_repeat('&nbsp;'2);
                                }
                                
                                if(
    $level == 3)
                                {
                                    
    $add str_repeat('&nbsp;'4);
                                }
                            
                            
    $subcat mysql_query"SELECT COUNT(photo_id)
                                                    FROM gallery_category as c
                                                    LEFT JOIN gallery_photos as p ON p.photo_category = '"
    .$sub_result[0]."'
                                                    GROUP BY c.category_id ORDER BY c.category_name ASC" 
    );
                            
    $sub_cat mysql_fetch_array$subcat );                        
                            
                            
    $cat_array[] = "<font face='Verdana, Arial, Helvetica, sans-serif' size='1'>".$add."|-<a href='cat_user.php?cid=".$row[0]."'>".$sub_result[1]."</a> "."(".$sub_cat[0].")</font><br />";
                                }
                            }
                        }
                    }
                    
    mysql_free_result$cat );
                    
    mysql_free_result$subresult ); 
                    
                    foreach(
    $cat_array as $category_link)
                    {
                            if(
    $counter == $number_of_categories_in_row)
                            {        
                                    
    $counter 1;
                            }
                            else
                            
    $counter++;

                            
    $cat_final .= "$category_link";
                    }

            }
    //Final result
    echo "$cat_final";
    ?>
    And the category table looks like this:

    ---------------------------------------------------------------------
    | category_id | category_name | category_parent | category_des |
    ---------------------------------------------------------------------
    1 | Sludge Process | 0 | Sludge Process
    13 | LAYER 1 | 0 | LAYER 1
    15 | Layer 2 | 13 | LAYER 1/Layer 2
    17 | Layer 3 | 13 | LAYER 1/Layer 3
    26 | Testing 2 | 25 | IN/Testing Sub/Testing 2
    20 | Layer 3.1 | 17 | LAYER 1/Layer 3/Layer 3.1
    25 | Testing Sub | 12 | IN/Testing Sub
    27 | Layer 2.1 | 15 | LAYER 1/Layer 2/Layer 2.1
    29 | Inlet 1 | 2 | Inlet Process/Inlet 1
    Like I said replace the code for the category listing, without the thumbnails.

    You can save this file as any name you would like and ask for it by doing an include('filename');

    then placing $cat_final; to where you would like the list to apear.

    I'm going to be working on a search page. I'll let you know how I do with that.

    Spence

  5. #430
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mrmbarnes
    Hi All

    I have movedmy image gallery code from an Apache server to an IIS server and it doesn't work anymore.

    I get the following error:

    Warning: copy(../../external/image-library/0.jpg) [function.copy]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\external\admin\image-library.php on line 247

    Warning: getimagesize(../../external/image-library/0.jpg) [function.getimagesize]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\external\admin\image-library.php on line 250

    Warning: Division by zero in c:\Inetpub\wwwroot\external\admin\image-library.php on line 274

    Fatal error: Call to undefined function ImageCreateFromJPEG() in c:\Inetpub\wwwroot\external\admin\image-library.php on line 290

    Line 247 is:

    PHP Code:
    copy($images_uploaded['tmp_name'][$counter], $images_dir."/".$filename); 
    Line 250 is:

    PHP Code:
    $size GetImageSize$images_dir."/".$filename ); 
    Line 274 is:

    PHP Code:
    $thumbnail_width = (int)($Config_tbheight_tall $size[0] / $size[1]); 
    Line 290 is:

    PHP Code:
    $source_handle $function_to_read($images_dir '/' $filename); 
    Any help would be great.

    Thanks

    mrmbarnes
    sounds like the image directory you are trying to save the photos in is not set to 644, this done by chmod. look back in this thread and I have a one liner which off the top of my head is like this: chmod('directory_name', 644);

    spence

  6. #431
    Adam Webb
    SitePoint Community Guest
    How would I go about checking the images arent to large (in terms of dimensions) and if they were auto resizing them so people who dont know better cant upload pictures the size of a barn door?

  7. #432
    Andrew McCafferty
    SitePoint Community Guest
    Good article overall. Just a quick point though - in preupload.php would it not be wise to validate the "$number_of_fields" variable in order to limit it to a sensible maximum? At the moment it looks like someone could request preupload.php?number_of_fields=1000000 which wouldn't make the server very happy...

  8. #433
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    L

    Hi....me again

    I m using This.
    PHP Code:
    $result mysql_query"SELECT category_id,category_name FROM gallery_category" );
        while( 
    $row mysql_fetch_array$result ) )
        {
    $photo_category_list .=<<<__HTML_END
        <option value="$row[0]">$row[1]</option>\n
    __HTML_END;
        }
        
    mysql_free_result$result ); 
    to receive some values from a table called category_id for my list/menu.
    the table got 3 fields
    1) category_id=$row[0]
    2) category_name=$row[1]
    3) Gerne=$row[2]

    as far as i understand right im using row[0] as a value in my list/menu
    <option value="$row[0]">$row[1]</option>\n
    and row[1] as what displayed in my list/menu options

    What can i do so every time i use 1 otion from the list/menu
    to post both valuesin my table??
    and i mean if i use vaue $row[0] to post both $row[1] & $row[2]
    in another table in 2 diferent fields???

    So far im using...

    PHP Code:
    INSERT INTO another_table(......'".addslashes($_POST['category'])."',
    '".addslashes($_POST['category(row[2])'])."',........... 
    to post the values in my table.But only the 1st part is working,
    the 2nd part sends an empty value


    What can i DO????

    What if i edit my category_id table to look like

    1) category_id=$row[0]=Disco (and NO 1 or 2 or....)
    2) category_name=$row[1]=Disco

    and post the same value 2 times??

  9. #434
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Both values posting

    i case that some1 is interesting here what i v done to post both values from category_list

    in the list menu i set as values both rows...

    $photo_category_list .=<<<__HTML_END
    <option value="$row[0]|$row[1]">$row[1]</option>\n

    separate by | and rename it as

    later in brake in 2 parts the category value $categoryboth

    $test = explode('|',$categoryboth);
    $photo_category= $test[0];
    $Gerne = $test[1];

    then i simply $POST the two variables...

    Probably its easy for some of you guys but i was trying to fix this for long time now.....

    I hoppe that some1 will find usefull this.


    I got a Quesion...
    why he is using the addslashes function???
    '".addslashes($_POST['category'])."'

    I dont get it.

  10. #435
    SitePoint Evangelist mrwooster's Avatar
    Join Date
    Jan 2006
    Posts
    518
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    very interesting

  11. #436
    shlok25
    SitePoint Community Guest
    addslashes is used for securing against hacker, script kiddies. it inserts \ i.e. slashes in front of any mlicious chars like: ',",/, .......

  12. #437
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thnx shlok25

    I m reading around the net a week now about serverside form validation.
    What a mesh!!!

    I dont know how to start and where to end!!!

    Any1 can help??

    adslashes is useless if magick quotes are ON. Right?

  13. #438
    Phil
    SitePoint Community Guest
    Hey y'all. This is an awsome tutorial for a novice like myself, but if you're going to copy and paste these delete and update functions from the last page. Make sure you change the table name from 'gallery_photo' to 'gallery_photos' in your queries. Don't waste a day and a half like I did ;) .

  14. #439
    dada
    SitePoint Community Guest
    i down loaded the uploada.php but it goes blank when i upload the photos from the preupload.php

  15. #440
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    try this

    after...
    PHP Code:
    else
                {
                    
    $query "INSERT INTO gallery_photos(
                    `photo_filename`,
                     `photo_caption`,.............etc 
    type echo $query; to see if working as expected

  16. #441
    jack
    SitePoint Community Guest
    Hi there great tutorial, I've got it running and displaying on my page the way I like and its all styled nicely, I'm a bit of a newbie to php/mysql and dont quiet understand where I should be adding in the extra functions to delete etc, could you give me some advice on how I would integrate the other functions into a form??
    Thanks for all your help

    Jack

  17. #442
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey all,
    I know we've gone over the thumbnail sizing all the way back on page 1, but I wanted to take it a step further.

    Personally, I think its ugly to have thumbnails on a page where some are wide, while others are tall (depending on the pictures orientation). Isn't there a way to make the thumbs all the same size (say, 100px by 100px), while keeping the photos original dimensions? I tried to change the height/width settings of the thumbs in the upload.php page, but as i suspected, it didn't work. And no, telling me to crop the original, and then thumbnail it is not an option.

    Below is an example of what I mean.





    Can anyone help? I'm using the code from Drew's Version Of Mayank's Photo Gallery if that simplifies things for you.
    Thanks.

  18. #443
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use the image as a bg in the css from a div and then put it as bg or do some calculations in php... but i would not know a really proper way to calculate always the same size.
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  19. #444
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello every one. i have modified my gallery ti display only display 6 thumbnails per page and i do not use the category.

    I have been able to modify the code so that only 6 results are shown with their caption but can get a code for paging.

    (1)what do i need to add to my code so that i get a previous or next link.

    (2) If u look at my code, if i click on a thumb nail it opens a big pic with caption on the same page. How can i modify it to open in another page.

    any help will be appreicated.

    thanks
    PHP Code:
    <?php
        
    include("conn.php");


        
    // initialization
        
    $result_array = array();
        
    $counter 0;
    $images_dir "photos";
    $Start 0;
    $ByPage 6;

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



        
    // Thumbnail Listing

        
    {
            
    $number_of_thumbs_in_row 2;
                         
            
    $result mysql_query"SELECT photo_id,photo_caption,photo_filename FROM gallery_photos $MyQuery $MyOrder limit $Start$ByPage ");
            
    $nr mysql_num_rows$result );

            if( empty( 
    $nr ) )
            {
                
    $result_final "\t<tr><td>No Images 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]."' /><br />".$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
        
    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_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
    echo <<<__HTML_END

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

    __HTML_END;
    ?>

  20. #445
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    problem solved.
    i didnt have a close look at the files attached by -animal777.
    thanks mate, u are a legend.
    cheers

  21. #446
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PixelSoul,
    You certainly get points for an pretty unorthadox (but effective) solution! I'll do that for now, but does anyone have a PHP answer?
    Quote Originally Posted by pixelsoul
    you can use the image as a bg in the css from a div and then put it as bg or do some calculations in php... but i would not know a really proper way to calculate always the same size.

  22. #447
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can't see photos

    Hi,

    Bit of a newbie to this uploading stuff, but have copied the scripts closely, the photos upload to db fine, but they don't display in viewgallery. Its probably something simple, any ideas?

  23. #448
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tree...

    Hi spence_noodle

    I read your post about tree categories...

    Can you explain a bit more your database srtucture ??

    Seems very interesting!!!

  24. #449
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    @ kevster - you would be better off starting a new thread (if you haven't already) as posts tend to get lost on big threads like this.

    @NTGre - PM spence_noodle, you will probably get a better response

    Spike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  25. #450
    Wadge! F4nat1c's Avatar
    Join Date
    Oct 2005
    Location
    South Wales, UK
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What are these posts about: http://www.sitepoint.com/forums/show...&postcount=426

    Are they auto generated by SitePoint or something, or are they posts made me non-members? If they are then I didn't know you could post here without becoming a member.
    OMFG SitePoint ROXORZ TEH BIG ONE111!
    Wish you were invisible?


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
  •