SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 39 of 39

Thread: Photo Gallery

  1. #26
    SitePoint Evangelist netkid's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think i need to understand PHP and mySQL a lil better...

    Santosh Sankar
    Bullish Bankers

  2. #27
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now that i'm using this script, one thing comes up: what if i wrongly upload an image and want to delete it or want to delete a complete gallery?
    How can i delete images from galeries?
    Can anyone give me an idea?
    thanks

  3. #28
    SitePoint Evangelist netkid's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm dunno...lol i never got time to make the gallery...its been tough round here...

    Santosh Sankar
    Bullish Bankers

  4. #29
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    guess you'r the only one who marked this thread...

  5. #30
    SitePoint Evangelist netkid's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol i coulda sworn i unsubscribed from it...

    Santosh Sankar
    Bullish Bankers

  6. #31
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello : )

    Long time since I saw this thread last time, had to read through the posts to see what it was all about.

    But to delete an image you would need to
    1. Delete the image entry in the database
    2. Delete the image/thumbnail file.

    If you need to delte whole album, you would first see what images are in it, then delete them as explained above, then simply delete the album from the database.

    If you need help for this I can do it : )

    website...where do i put in the database access stuff in ur version??
    Hmm, I'm afraid I never saw this post :/
    Still need help?
    - website

  7. #32
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by website
    But to delete an image you would need to
    1. Delete the image entry in the database
    2. Delete the image/thumbnail file.

    If you need to delte whole album, you would first see what images are in it, then delete them as explained above, then simply delete the album from the database.

    If you need help for this I can do it : )
    of course i'd love you help me on exactly deleting either photos or galeries.
    i must confess i feel a little embarassed from profiting from your offer, but ... i accept it
    anyway here its too late now. i'll be back tomorrow
    i checked my uploaded files, but images arent there alone, but i guess all together inside some strange kind of files...
    you can see an example of my gallery at work here:
    http://www.ebi-vasco-gama.rcts.pt/mi...?galeria=1900a
    thanks a lot

  8. #33
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i googled thumbs.db and found this:
    http://www.fcs.iastate.edu/computer/...bs/default.htm
    so i guess these files can be deleted with no problems;
    so, what i've to find out is the way of buiding a delete query that deletes both the miniature and normal pic from respective folder and also the database/table entry...all in simultaneous action
    and also need a kind of a list from where i can choose what to delete

  9. #34
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for late reply, many things going on...
    thumbs.db has nothing to do with this I belive. That is simply as explained on the website a file windows uses when showing thumbnails when viewing folders.

    Anyhow, can you show my the database layout and how the files are saved. Or do you use the scripts I posted above?
    - website

  10. #35
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you dont have to be sorry, since its me who's beneficting from it...
    thanks for helping
    i did use the scripts i think i posted here
    if you want i can post the scripts i'm actually using and also the tables i use, too, but i just made minor changes to what was posted here

  11. #36
    Lost
    Join Date
    Dec 2002
    Location
    Norway
    Posts
    225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to create something pretty much similar to this, but I need the script to handle 1-10 pictures, AND it must both resize all pictures to a 298 x 224 and make thumbnails of all the pictures.... having a hard job doing this.

    Plus of course the fact that all pictures must belong to a specific users item (users can have more than one item)... anyone care to lend out a hand, I would really appreciate it.

  12. #37
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    New York
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am reading too, but have not been able to do any thing. Too Stupid I guess.

  13. #38
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bah, long time since none OO programming, might be some things wrong with this but here it goes:
    PHP Code:
    <?php
    //delete.php

    define('LARGE_IMAGE_DIR''some/path');
    define('THUMBNAIL_DIR''some/path');

    function 
    erase_img($id$ext) {
      
    unlink(LARGE_IMAGE_DIR $id '.' $ext);
      
    unlink(THUMBNAIL_DIR 'thumb_' $id '.' $ext);
    }

    function 
    delete_img($id) {
      if (
    mysql_query('DELETE FROM Images WHERE id = ' $id)) {
          
    erase_img($id);
          echo(
    'Image has been deleted');
      } else {
          echo(
    'Error: ' mysql_error());
      }
    }

    function 
    delete_album($id) {
      if (!
    $rslt mysql_query('SELECT id FROM Images WHERE Album_id = ' $id)) {
          echo(
    'Error: ' mysql_error());
      }
      while(
    $row mysql_fetch_array($rslt)) {
        
    erase_img($row['id']);
      }

      
    $rslt1 mysql_query('DELETE FROM Images WHERE Album_id = ' $id);
      
    $rslt2 mysql_query('DELTE FROM Albums WHERE id = ' $id);

      if (
    $rslt1 && $rslt2 && $rslt) {
          echo 
    'Album deleted successfully...';
      }
    }
    $id = (int) $_GET['id'];
    switch (
    $_GET['type']) {
      case 
    'img':
        
    delete_img($id);
      break;
      case 
    'album':
        
    delete_album($id);
      break;
    }
    ?>
    So you dump this in a file called delete.php
    The scripts take two parameters in the url,
    type which can be either img or album.
    id which then refers to either the id of the album or the image.

    So to erase album with id number 16 you would run
    delete.php?type=album&id=16
    and so on. Having trouble understanding?

    Anyhow, then you can add links the album pages which then take the id of the album/image and add it to the url of the delete file, then you could delete whole album with one hit.

    Hope this works and helps!
    - website

  14. #39
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi
    i owe you an explanation: its been impossible to me, due to my health, to try your code; as soon as i'm ok again, i'll let you know.
    Thank you


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
  •