SitePoint Sponsor

User Tag List

Page 8 of 31 FirstFirst ... 45678910111218 ... LastLast
Results 176 to 200 of 767
  1. #176
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Slovenia
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hiya !

    This gallery is realy cool, but this with files in one directory ... this is not so good for me. Is any options, to change script (and add "category_dir" to mysql), to generate directories into "gallery" folder ... or input box (in preupload.php), to write new folder's name (date_desctiption -> 20040226_birthday , ... ).

    If someone do this ... then I paste here this source with comments & voting. Soon. =) Im working on that =)

    I just need to separate categories in diferent folders ... =) HELP ME!

    Thanks .. From sLOVEnia with love !
    v1Ru5

  2. #177
    SitePoint Member
    Join Date
    Oct 2003
    Location
    York, UK
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by v1ru5
    hiya !

    This gallery is realy cool, but this with files in one directory ... this is not so good for me. Is any options, to change script (and add "category_dir" to mysql), to generate directories into "gallery" folder ... or input box (in preupload.php), to write new folder's name (date_desctiption -> 20040226_birthday , ... ).

    If someone do this ... then I paste here this source with comments & voting. Soon. =) Im working on that =)

    I just need to separate categories in diferent folders ... =) HELP ME!

    Thanks .. From sLOVEnia with love !
    v1Ru5
    what code are you using to create new categories?

    i've been having php generate new directories when the category is created (you can't do it on upload otherwise multiple uploads will make php tell you the cirectory already exists without checking if it's there already)

    can i see your category creation code? i had problems with this for a while, i might be able to help out...

    jonic.

  3. #178
    SitePoint Zealot Norrad's Avatar
    Join Date
    Nov 2003
    Location
    Thailand
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great tutorial! Just what I've been looking for, but, is there any way to improve the generated thumbnails image quality? They seem very pixilated...

  4. #179
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Slovenia
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    F*** !
    i wrote reply and click Submit -> page cannot be display, damnit !
    so, once again :\

    jonic : i copy source for adding categories from here, previous pages, and it is :
    http://www.streznik-101.net/photo/edit_category.phps

    I just wanna to be pictures separated in directories ... if I have 10000 pictures in one directory, 1,2,3,4,5....jpg how will I know what is what =)
    So it would be nice to create directory for each category, and then increasing numbers (1.2.3.4.jpg..).
    Maybe this could be here, in this source, when adding new category, to create directory with name I want (date_description, as I said in previous post), and in preupload.php when uploading in category, to actualy upload in directory that belongs to category.
    I also added columns in mysql tables for this, category_dir, category_author, category_view, category_date

    Its easy to say ... I understand all php programming and I wrote a lot of lines, but this with thumbnails and directories is not my skill, or something =)

    and ... sorry about my english language :\

    Thanks, v1Ru5 =)

  5. #180
    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 Norrad
    Great tutorial! Just what I've been looking for, but, is there any way to improve the generated thumbnails image quality? They seem very pixilated...
    You should post a little more info. on what type of image creation code you are using. I mean, are you using the GD library or imagemagik? What version? In version 2 of the GD library you should use imageCreateTrueColor() it makes a HUGE difference! Chances are you are using imageCreate() instead of imageCreateTrueColor(). ImageCreate() is for the pre version 2 folks and it is most likely the culprit in your case.

    There are lots of rather poor tutorials on the GD library on the net and trust me I am still struggling too with this but this is the best tutorial I have found so far http://nyphp.org/content/presentations/GDintro/gd1.php It will guide you through finding out what version of the GD library is installed all the way up to some great examples. Its worthwhile taking just for a refresher also...

    Hope this helps you out...
    Drew

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

  6. #181
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Norrad
    Great tutorial! Just what I've been looking for, but, is there any way to improve the generated thumbnails image quality? They seem very pixilated...
    try my upload script. I has worked for other people here.

    http://www.anglersforchrist.com/gallery/upload.txt

  7. #182
    If it aint Dutch it aint much Kilroy's Avatar
    Join Date
    Oct 2003
    Location
    The Netherlands
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My preupload.php doesn't show any uploadfield whatsoever. Here's the code:

    PHP Code:
    <?php 
     
     
    // Include design
     
    include 'design.inc.php';
     
     
    // Include configuration file
     
    include 'config.inc.php'

     
    // Initialization 
     
    $photo_upload_fields ''
     
    $counter 1

    // If you want more fields, then the call to this page should be like, 
    // preupload.php?number_of_fields=20

        
    if( $_GET['number_of_fields'] )
        
    $number_of_fields = (int)($_GET['number_of_fields']);

        
    // Firstly Lets build the Category List

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

    // Lets build the Photo Uploading fields
        
    while( $counter <= $number_of_fields )
        {
    $photo_upload_fields .=<<<__HTML_END
    <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>
    __HTML_END;
        
    $counter++;
        }

    // Final Output
    echo <<<__HTML_END
    $design_header

    <div class="content">
    <h1>Upload photos</h1>
    <form enctype='multipart/form-data' action='upload.php' method='post' name='upload_form'>
    <table width='90%' border='0' align='center' style='width: 90%;'>
    <tr>
        <td>
            Select Category
            <select name='category'>
                
    $photo_category_list
            </select>
        </td>
    </tr>
    <tr>
        <td>
            <p>
    $photo_upload_fields</p>
        </td>
    </tr>

    <tr>
        <td>
                <input type='submit' name='submit' value='Add Photos' />
        </td>
    </tr>
    </table>
    </form>
    </div>
    $design_footer
    __HTML_END;
    ?>
    Does anyone know what's wrong with it? The script is located at http://hd-clan.2dhost.net/preupload.php

    Thanks,

    Kilroy

  8. #183
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    France
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the same problem as another poster, script works just fine, except only a maximum of six pix get uploaded because the count of the photo_filename array is always 5.

    Why does it stop at 5?

  9. #184
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or the max_file_upload limit is being exceeded

  10. #185
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    France
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it's not that. I tried with very small pics. The other poster had the exact same problem, the array is only 0 - 5.

  11. #186
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Has anyone stripped the HTML tags from this yet, so that it only returns an array in the browser window?

    Very handy for trouble shooting. I'm doing it sometime today or tomorrow but thought I'd check-see if it's been done yet just to save some time. If you have it and don't mind sharing, please consider posting it.

    I'll post it when I have it done. Thanks everyone.

  12. #187
    SitePoint Member
    Join Date
    Mar 2004
    Location
    UK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Undefined offset

    Can anyone help?

    I seem to be getting this error when i tyr running the script.

    Notice: Undefined offset: 1 in G:\htdocs\website\Admin\upload.php on line 28

    This is line 28

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

    and the code around it...

    while($counter <= count($photos_uploaded)) {
    if($photos_uploaded['size'][$counter] > 0) {
    if(!array_key_exists($photos_uploaded['type'][$counter], $photo_types)) {
    $result_final .= 'File ' . ($counter + 1) .
    ' is not a photo<br />';
    } else {

    If anyone out there can help get rid of this error please let me know.
    other than that error everything is working well.
    Cheers

  13. #188
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    putting thumbs in a different folder than the uploaded images

    I want to store the thumbs in a folder within the 'photos' folder.

    something like gallery > photos > thumbs> tb_image.jpg

    here's what i have now but it's not working:
    PHP Code:
    $function_to_write$destination_handle$file_dir."/thumbs/".$filename ); 
    any ideas? or is it not possible?

    bUSCh

  14. #189
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone?
    any idea?

  15. #190
    SitePoint Member
    Join Date
    Apr 2004
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question I am getting a number of errors

    Hi am quite new to PHP, and need some HELP please.

    The tutorial is great and easy to follow. Just what I needed.
    However, I am getting some errors:

    I added the delete and edit photo scripts which you so kindly provided on these pages to preupload.php (to keep all the image functions on one page)

    This is the script where the problem is:

    <?php
    include("config.inc.php");

    if(empty($_POST['action'])) //<--This is the line where I get the error
    {
    // Firstly Lets get the Photo ID
    ?>

    This is the error:

    Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in c:\program files\apache group\apache\htdocs\preupload.php on line 72

    Any ideas anyone. I bet it is something really simple!!

    My photo's upload fine, however when I upload them I get the following errors:

    Warning: imagecreatetruecolor(): Invalid image dimensions in c:\program files\apache group\apache\htdocs\upload.php on line 90

    Warning: imagecopyresized(): supplied argument is not a valid Image resource in c:\program files\apache group\apache\htdocs\upload.php on line 93

    Warning: imagejpeg(): supplied argument is not a valid Image resource in c:\program files\apache group\apache\htdocs\upload.php on line 97

    Warning: imagedestroy(): supplied argument is not a valid Image resource in c:\program files\apache group\apache\htdocs\upload.php on line 98
    File 1 Added
    --> File 1 Added

    The other problems is that my thumbnails doesn't show, is this connected in any way?This is the script:

    // This script builds the Thumbnails with GD
    $function_suffix = $gd_function_suffix[$filetype];
    $function_to_read = 'ImageCreateFrom'.$function_suffix;
    $function_to_write = 'Image'.$function_suffix;

    // This script reads the source file
    $source_handle = $function_to_read ( $images_dir."/".$filename );

    //Check the file, if it returns true build an image-placeholder for the thumbnail
    //And resize it
    if($source_handle)
    {
    // The image placeholder is created
    $destination_handle = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height );

    // The image is resized
    ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
    }

    // This script saves thye thumbnail
    $function_to_write( $destination_handle, $images_dir."/tb_".$filename );
    ImageDestroy($destination_handle );

    I am using PHP 4.3.4 and GD 2.0.15

    Please help, I know it is a lot all at once, but I really need to get this sorted!!

    Thank you

    Trine

  16. #191
    SitePoint Enthusiast zeedoo's Avatar
    Join Date
    Jan 2002
    Location
    India
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    make sure there are no white spaces after any here doc ... e.g. __HTML_END kind of code ...

  17. #192
    SitePoint Member
    Join Date
    Apr 2004
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question White spaces

    Quote Originally Posted by zeedoo
    make sure there are no white spaces after any here doc ... e.g. __HTML_END kind of code ...
    I have checked the white spaces in the entire document without result (I assume you are referring to my first problem!)

    Any other suggestions? Anyone?

  18. #193
    SitePoint Member
    Join Date
    Apr 2004
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I need help urgently!

    Please help!

    I am following the Build an Automated PHP Gallery in Minutes tutorial!

    I get the following error:

    Parse error unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in c:\program files\apache group\apache\htdocs\preuploadextra.php on line 72

    This is the script where I get the error:

    <?php

    include("config.inc.php");
    if(empty($_POST['action']))

    and this is the full script:

    <?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;

    // Firstly Lets build the Category List
    $result = mysql_query('SELECT category_id,category_name FROM gallery_category');
    while($row = mysql_fetch_array($result)) {
    $photo_category_list .= <<<END
    <option value="$row[0]">$row[1]</option>\n
    END;
    }
    mysql_free_result( $result );

    // Lets build the Image Uploading fields
    while($counter <= $number_of_fields) {
    $photo_upload_fields .= <<<END
    <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>
    END;
    $counter++;
    }

    // Final Output
    echo <<<END
    <html>
    <head>
    <title>Lets upload Photos</title>
    </head>
    <body>
    <h1>Upload Pictures</h1>
    <form enctype="multipart/form-data"
    action="upload.php" method="post"
    name="upload_form">
    <table width="90%" border="0"
    align="center" style="width: 90%;">
    <tr><td>
    Select Category
    <select name="category">
    $photo_category_list
    </select>
    </td></tr>
    <!—Insert the image fields here -->
    $photo_upload_fields
    <tr><td>
    <input type="submit" name="submit"
    value="Add Photos" />
    </td></tr>
    </table>
    </form>
    <br><br>



    <?php

    include("config.inc.php");
    if(empty($_POST['action']))
    {
    // Firstly Lets get the Photo ID
    ?>

    <form name="edit_photo" action="admin2.php" method="post">

    <b>Enter Photo ID/b> <input type="text" name="photoid" />
    <input type="submit" value="find" name="action" />

    </form>

    <?php
    }
    else if( strcasecmp($_POST['action'], "find")==0 )
    {
    $result = mysql_query( "SELECT photo_caption,photo_filename,photo_category FROM gallery_photos WHERE photo_id='".addslashes($_POST['photoid'])."'" );
    $nr = mysql_num_rows( $result );

    if( $nr < 1 )
    {
    echo("Photo not found in DB!");
    exit;
    }

    $row = mysql_fetch_array( $result );
    mysql_free_result( $result );

    echo("<a href='viewgallery.php?cid=".$row['photo_category']."&pid=".$_POST['photoid']."'><img src='".$images_dir."/tb_".$row[1]."' border='0' alt='".$row[0]."' /></a>");

    // Firstly Lets build the Category List

    $result = mysql_query( "SELECT category_id,category_name FROM gallery_category" );
    while( $row2 = mysql_fetch_array( $result ) )
    {

    if( $row2["category_id"] == $row["photo_category"] )
    {
    $category_list .=<<<END
    <option value="$row2[0]" selected>$row2[1]</option>\n
    END;
    }
    else
    {
    $category_list .=<<<END
    <option value="$row2[0]">$row2[1]</option>\n
    END;
    }
    }
    mysql_free_result( $result );
    $category_list = '<select name="categoryid">'.$category_list.'</select>';
    ?>

    <form name="photo_move" action="admin2.php" method="post">

    <b>Move Photo/b><br />
    Select New Category: <?php echo($category_list); ?><br />
    Caption: <input type="text" name="caption" value="<?php echo($row["photo_caption"]); ?>" /><br />
    <input type="hidden" value="<?php echo($_POST['photoid']); ?>" name="photoid" />
    <input type="submit" value="save" name="action" />

    </form>

    <br /><br />

    <form name="photo_delete" action="admin2.php" method="post">
    <b>Delete Photo?</b><br />
    <input type="hidden" value="<?php echo($_POST['photoid']); ?>" name="photoid" />
    <input type="submit" value="delete" name="action" onclick="return confirm('Are you sure you want to do delete this photo?')" />

    </form>

    <?php
    }
    else
    {
    if( strcasecmp($_POST['action'], "save")==0 && !empty( $_POST['categoryid'] ) )
    {
    edit_photo($_POST['photoid'], $_POST['caption'], $_POST['categoryid']);
    }
    else if( strcasecmp($_POST['action'], "delete")==0 && !empty( $_POST['photoid'] ) )
    {
    delete_photo($_POST['photoid']);
    }
    else
    {
    echo("Action not understood"); exit;
    }

    echo("Process completed!");
    }

    // the functions here

    function edit_photo( $photo_id, $new_caption, $new_category )
    {
    mysql_query( "UPDATE gallery_photos SET photo_caption='".addslashes( $new_caption )."', photo_category='".addslashes( $new_category )."' WHERE photo_id='".addslashes( $photo_id )."'" );
    }

    function delete_photo($photo_id)
    {
    global $images_dir;
    $result = mysql_query("
    SELECT photo_filename
    FROM gallery_photos
    WHERE photo_id = '" . addslashes($photo_id) . "'
    ");
    list($filename) = mysql_fetch_array($result);
    mysql_free_result($result);

    unlink($images_dir . '/' . $filename);

    mysql_query("
    DELETE FROM gallery_photos
    WHERE photo_id='" . addslashes($photo_id) . "'
    ");
    }

    ?>






    </body>
    </html>
    END;
    ?>

  19. #194
    SitePoint Member
    Join Date
    Apr 2004
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you Klemeine

    Klemeine helped me sort out some of my code, which is great!

    This is what my code looks like now:

    <?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;

    // Firstly Lets build the Category List
    $result = mysql_query('SELECT category_id,category_name FROM gallery_category');
    while($row = mysql_fetch_array($result)) {
    $photo_category_list .= <<<END
    <option value="$row[0]">$row[1]</option>\n
    END;
    }
    mysql_free_result( $result );

    // Lets build the Image Uploading fields
    while($counter <= $number_of_fields) {
    $photo_upload_fields .= <<<END
    <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>
    END;
    $counter++;
    }

    // Final Output
    echo <<<END
    <html>
    <head>
    <title>Lets upload Photos</title>
    </head>
    <body>
    <h1>Upload Pictures</h1>
    <form enctype="multipart/form-data"
    action="upload.php" method="post"
    name="upload_form">
    <table width="90%" border="0"
    align="center" style="width: 90%;">
    <tr><td>
    Select Category
    <select name="category">
    $photo_category_list
    </select>
    </td></tr>
    <!?Insert the image fields here -->
    $photo_upload_fields
    <tr><td>
    <input type="submit" name="submit"
    value="Add Photos" />
    </td></tr>
    </table>
    </form>
    <br><br>
    END;

    include("config.inc.php");
    if(empty($_POST['action']))
    {
    // Firstly Lets get the Photo ID
    ?>

    <form name="edit_photo" action="admin.php" method="post">

    <b>Enter Photo ID/b> <input type="text" name="photoid" />
    <input type="submit" value="find" name="action" />

    </form>

    <?php
    }
    else if( strcasecmp($_POST['action'], "find")==0 )
    {
    $result = mysql_query( "SELECT photo_caption,photo_filename,photo_category FROM gallery_photos WHERE photo_id='".addslashes($_POST['photoid'])."'" );
    $nr=mysql_num_rows($result);

    if( $nr < 1 )
    {
    echo("Photo not found in DB!");
    exit;
    }

    $row = mysql_fetch_array( $result );
    mysql_free_result( $result );

    echo("<a href='viewgallery.php?cid=".$row['photo_category']."&pid=".$_POST['photoid']."'><img src='".$images_dir."/tb_".$row[1]."' border='0' alt='".$row[0]."' /></a>");

    // Firstly Lets build the Category List

    $result = mysql_query( "SELECT category_id,category_name FROM gallery_category" );
    while( $row2 = mysql_fetch_array( $result ) )
    {

    if( $row2["category_id"] == $row["photo_category"] )
    {
    $category_list .=<<<END
    <option value="$row2[0]" selected>$row2[1]</option>\n
    END;
    }
    else
    {
    $category_list .=<<<END
    <option value="$row2[0]">$row2[1]</option>\n
    END;
    }
    }
    mysql_free_result( $result );
    $category_list = '<select name="categoryid">'.$category_list.'</select>';
    ?>

    <form name="photo_move" action="admin.php" method="post">

    <b>Move Photo/b><br />
    Select New Category: <?php echo($category_list); ?><br />
    Caption: <input type="text" name="caption" value="<?php echo($row["photo_caption"]); ?>" /><br />
    <input type="hidden" value="<?php echo($_POST['photoid']); ?>" name="photoid" />
    <input type="submit" value="save" name="action" />

    </form>

    <br /><br />

    <form name="photo_delete" action="admin.php" method="post">
    <b>Delete Photo?</b><br />
    <input type="hidden" value="<?php echo($_POST['photoid']); ?>" name="photoid" />
    <input type="submit" value="delete" name="action" onclick="return confirm('Are you sure you want to do delete this photo?')" />

    </form>

    <?php
    }
    else
    {
    if( strcasecmp($_POST['action'], "save")==0 && !empty( $_POST['categoryid'] ) )
    {
    edit_photo($_POST['photoid'], $_POST['caption'], $_POST['categoryid']);
    }
    else if( strcasecmp($_POST['action'], "delete")==0 && !empty( $_POST['photoid'] ) )
    {
    delete_photo($_POST['photoid']);
    }
    else
    {
    echo("Action not understood"); exit;
    }

    echo("Process completed!");
    }

    // the functions here

    function edit_photo( $photo_id, $new_caption, $new_category )
    {
    mysql_query( "UPDATE gallery_photos SET photo_caption='".addslashes( $new_caption )."', photo_category='".addslashes( $new_category )."' WHERE photo_id='".addslashes( $photo_id )."'" );
    }

    function delete_photo($photo_id)
    {
    global $images_dir;
    $result = mysql_query("
    SELECT photo_filename
    FROM gallery_photos
    WHERE photo_id = '" . addslashes($photo_id) . "'
    ");
    list($filename) = mysql_fetch_array($result);
    mysql_free_result($result);

    unlink($images_dir . '/' . $filename);

    mysql_query("
    DELETE FROM gallery_photos
    WHERE photo_id='" . addslashes($photo_id) . "'
    ");
    }
    ?>
    </body>
    </html>

    However, when I run it I don't get any errors, but only the upload fields and a field saying enter photo ID comes up, is that what is supossed to happen. Shouldn't more firlds show?
    Also, if I enter a photo-Id (F.eks. 1.jpg) in the last box and click find, I get "Action not understood" returned.

    I am so close now. Please help...

  20. #195
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    UK
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have this working fine on 1 server but not on another.

    What happens is the file seems to be uploaded and name of the file and its thumbname added to the directory but when it shows a preview of the image a red X is shown. So even though the name has been added to the directory and to the database the file isn't actually there. Is this a permission problem on the directory or something else?

  21. #196
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    UK
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still can't work it out. If the folder permissions were wrong then the files wouldn't show in the folder, would they?

    If I check the directory using SSH the files are listed and with a size.

  22. #197
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    UK
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No one

  23. #198
    SitePoint Member
    Join Date
    May 2003
    Location
    Waddinxveen
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Navigation links

    Quote Originally Posted by animal777
    The single image navigation has been brought up here before. I recommend all people new to this discussion read it all the way through. We came a long way and learned a lot of things.

    To do the navigation, (BTW, I wrote the thumb nav) you would have to complete recode what happened when you click on a thumbnail. It does a SQL query that says:

    PHP Code:
    $result mysql_query"SELECT photo_caption,photo_filename 
    FROM gallery_photos WHERE photo_id='"
    .addslashes($pid)."'" ); 
    You are only retrieving 1 photo from the database, so there is nothing to nav thru. I looked at trying to fix this, but simply was not a good enough coder to do so. Maybe someone here will step up to the plate.
    After some trying I got it to work. See http://195.241.118.125/photo-gallery...?cid=5&pid=106 for a sample, and http://195.241.118.125/photo-gallery/viewgallery.txt for the coding.
    I didn't want to win a price for nice and clean coding, it is just a quick and dirty solution. But it works ;-) . Enjoy.

  24. #199
    Anonymous
    SitePoint Community Guest
    I started coding PHP recently trying to create a photo album as explained in this usefull tutorial. But now I am stuck? I set things up as the tutorial told me, but when I try to upload some pictures I get the following error messages? Could somebody help me out with this? Thanks a lot!

    (I used the same coding as in the downloadable archive...)

    Error messages:

    Warning: copy(photos/5.jpg): failed to open stream: No such file or directory in d:webserverhtdocstestupload.php on line 51

    Warning: getimagesize(photos/5.jpg): failed to open stream: No such file or directory in d:webserverhtdocstestupload.php on line 54

    Warning: Division by zero in d:webserverhtdocstestupload.php on line 62

    Fatal error: Call to undefined function: imagecreatefromjpeg() in d:webserverhtdocstestupload.php on line 72

  25. #200
    SitePoint Member nickthibert's Avatar
    Join Date
    May 2004
    Location
    Ottawa
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there!

    Excellent code!

    I've been working with it for a while now to get everything configured etc... but I keep getting theses 2 errors whenever I go to the viewgallery.php page:


    Notice: Undefined index: cid in D:\proto\nick\viewgallery.php on line 9

    Notice: Undefined index: pid in D:\proto\nick\viewgallery.php on line 10

    I wrote it out myself and couldn't get it to work, and then even copy and pasted it from the .zip file for this code from this webpage and still get the same errors... Anyone? Please help, as I really like this page!


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
  •