SitePoint Sponsor

User Tag List

Page 24 of 31 FirstFirst ... 14202122232425262728 ... LastLast
Results 576 to 600 of 767
  1. #576
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation

    Hey all,
    A new design I'm working on needs a little bit of... oh, I dunno. Anyway, what I'm looking for this this: thumbnails in a CSS embedded field (don't worry, i got the square crop figured out), which point at the main image. However, when you click the thumb, the main image changes, but the physical URL does not.

    I've enclosed an example image of what I mean to clarify. I'm mostly after the thumbnails on the same page with the URL not changing. example

    Any pointers, hints, or sucks-to-be-you's will be appreciated.

  2. #577
    SitePoint Enthusiast Bill007's Avatar
    Join Date
    Jul 2006
    Location
    New plymouth, New Zealand
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Not sure waht you are wanting here

    The example is static and nothing is clickable

    I guess you want to click on a thumbnail and display the larger image

    Bill007

  3. #578
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah the image is just a visual. And my goal is what you suggested. Click the smaller one, and appears as a larger one. I just dont want the page URL to change when I do it. I know it can be done, I just forget how. Even if someone has seen an example online somewhere, that'd be a good launching point for me.

  4. #579
    SitePoint Zealot hephaistion's Avatar
    Join Date
    Oct 2006
    Location
    Polis Chrysochous, Cyprus
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    file size

    did i read somewhere that a thumbnail generated automatically will be as large as the original?

  5. #580
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Quote Originally Posted by renikdelan
    Hey all,
    A new design I'm working on needs a little bit of... oh, I dunno. Anyway, what I'm looking for this this: thumbnails in a CSS embedded field (don't worry, i got the square crop figured out), which point at the main image. However, when you click the thumb, the main image changes, but the physical URL does not.

    I've enclosed an example image of what I mean to clarify. I'm mostly after the thumbnails on the same page with the URL not changing. example

    Any pointers, hints, or sucks-to-be-you's will be appreciated.
    Renikdelan - are you looking for an "imageswap" type of thing similar to this?:

    http://www.gr0w.com/articles/imageswapper.php

    Of course, that one is not based on a database driven gallery - unfortunately.

    I've been trying to implement something like this with the Gallery but haven't been able to do so yet.

    Let me know if you have any luck.

  6. #581
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I was looking for something like that. The only problem with that example is they shrink the original image in the php/html code for the thumbnail. If I/we can overcome that by drawing from the sql database, then damn.

    After thinking about it more, the SP Gallery thumbnails wouldnt be too bad to replace the array that they have. The more concerning part is getting the images that are of decent size to load at a fairly quick rate... perhaps if the fullsize images could be converted to SWF during the upload, then put a preloader for it on the page? I think I remember Infizi working on something like that, but havent seen him in a while.... any ideas?
    Last edited by renikdelan; Oct 28, 2006 at 11:14.

  7. #582
    SitePoint Zealot backtobasics's Avatar
    Join Date
    Aug 2006
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try using an iframe to load the larger photos? Or you check out Jeroen Wijerings PHP image gallery. He uses JavaScript to load the new images, it may help you.

    Also, what do I need to change to able to allow GIF files to be uploaded?? Thanks
    Last edited by backtobasics; Nov 5, 2006 at 17:37.

  8. #583
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello can anybody help, I found this code excellent but I now have a problem each time I submit the Add photso form I can see that upload.php has been called but it is running very slow, I eventually get the 'cannot display page error' and no data or images are uploaded to my web server. Here is the code from my upload.php file and the preupload.php.

    Any help would be appreciated

    Thanks in advance

    UPLOAD.PHP

    PHP Code:
    <?php
    //Fetch the image array sent by preupload.php
    $photos_uploaded=$_FILES['photo_filename'];

    //Fetch the image names array
    $photo_name=$_POST['photo_name'];

    //Fetch the image captions array
    $photo_caption=$_POST['photo_caption'];

    //set an array for file types
    $photo_types=array(
    'image/pjpeg'=>'jpg',
    'image/jpeg'=>'jpg',
    'image/gif'=>'gif',
    'image/bmp'=>'bmp',
    'image/x-png'=>'png'
    );

    //validate the uploaded file is an image
    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
                {
                
    $result_final.='File'.($counter+1).' was uploaded successfully.<br />';
                }
            }
        }

    //Add the new entry into the t_photos and fetch a unique ID
    mysql_query("
        INSERT INTO t_photos(
        photo_name,
        photo_caption,
        photo_filename,
        photo_cat
        ) VALUES (
        '"
    .$photo_name[$counter]."',
        '"
    .$photo_caption[$counter]."',
        '0',
        '"
    .$_POST['category']."'
        )
        "
    );

    $new_id=mysql_insert_id(); //new id generated

    //get the filetype of the uploaded file
    $filetype=$photos_uploaded['type'][$counter];

    //get the extension for the new name
    $extension=$known_photo_types[$filetype];

    //generate a new name
    $filename="$new_id.$extension";

    //update the filename in the database
    mysql_query("
        UPDATE t_photos SET
        photo_filename='
    $filename'
        WHERE photo_id='new_id'
        "
    );

    //store the images
    copy($photos_uploaded['tmp_name'][$counter],$images_dir.'/'.$filename);
    move_uploaded_file($photos_uploaded['tmp_name'][$counter],$images_dir.'/'.$filename;

    //create automatic thumbnails of images
    //determine if the imag is a tall one or wide one
    $size=GetImageSize($images_dir."/".$filename);

    //Wide image
    if($size[0]>$size[1])
    {
    $thumbnail_width=100;
    $thumbnail_height=(int)(100*$size[1]/$size[0]);
    }
    //Tall image
    else
    {
    $thumbnail_height=100;
    $thumbnail_width=(int)(100*$size[0]/$size[1]);
    }

    //set an array for file types
    $gd_function_suffix=array(
    'image/pjpeg'=>'jpg',
    'image/jpeg'=>'jpg',
    'image/gif'=>'gif',
    'image/bmp'=>'bmp',
    'image/x-png'=>'png'
    );

    //Get the name suffix on the basis of the mime type
    $function_suffix=$gd_function_suffix[$filetype];

    //Build the function name for ImageCreateFromSUFFIX
    $function_to_read='ImageCreateFrom'.$function_suffix;

    //Build function name for ImageSUFFIX
    $function_to_write='Image'.$function_suffix;

    //read the source file
    $source_handle=$function_to_read($images_dir.'/'.$filename);

    if(
    $source_handle)
        {
        
    //Create a blank image for the thumbnail
        
    $destination_handle=ImageCreateTrueColor($thumbnail_width,$thumbnail_height);
        
    //resize it
        
    ImageCopyResampled($destination_handle,$source_handle,0,0,0,0,$thumbnail_width,$thumbnail_height,$size[0],$size[1]);
        }

    //save the thumbnail
    $function_to_write($destination_handle,$thumbs_dir.'/tb_'.$filename);

    ?>
    PREUPLOAD.PHP

    PHP Code:
    <?php
    //phpinfo();
    include '../dbconnect.php';

    //initialisation
    $photo_upload_fields='';
    $counter=1;

    //If we want more fields, the use preupload.php?number_of_fields=20
    $number_of_fields=(isset($_GET['number_of_fields']))?(int)($_GET['number_of_fields']):5;

    //Build the Category List
    $result=mysql_query('SELECT cat_id,cat_name FROM t_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);

    //Build the Image Uploading Fields
    while($counter<=$number_of_fields)
    {
    $photo_upload_fields.=<<<__HTML_END
    <tr>
    <td align="right"><label>Photo 
    {$counter}:</label></td>
    <td><input name="photo_filename[]" type="file" size="50" class="txt" /></td>
    </tr>
    <tr>
    <td align="right"><label>Photo Name:</label></td>
    <td><input name="photo_name[]" type="text" size="50" class="txt"/></td>
    </tr>
    <tr>
    <td align="right" valign="top"><label>Photo Caption:</label></td>
    <td><textarea name="photo_caption[]" cols="50" rows="3" class="txt"></textarea>
    <p></p></td>
    </tr>
    __HTML_END;
    $counter++;
    }

    //Final Output
    include '../top.php';
    echo <<<__HTML_END

    <body>
    <div id="DB_Admin" align="center">
        <form enctype="multipart/form-data" action="upload.php" method="post" name="upload_form">
        
        <p class="adminTitle">DATABASE ADMINISTRATION - UPLOAD NEW PHOTOS</p>
        <br>
            <table width="500" align="center" cellpadding="2">
                <tr><td colspan="2"><div align="center">
                    <label>Select Category</label>
                        <select name="category">
                            
    $photo_category_list
                        </select>
                        <p></p>
                </div></td></tr>
            <!-Insert image fields here-->
                
    $photo_upload_fields
                <tr><td colspan="2"><div align="center">
                <br>
                    <input type="submit" name="submit" value="Add Photos" class="btn"></input>
                <br>
                </div></td></tr>
            </table>
        <div id="back">
          <p><a href="index.php">&nbsp;BACK&nbsp;<br>
          </a></p>
        </div>
        
        </form>
    </div>
    </body>

    __HTML_END;
    include 
    '../footer.htm';
    ?>

  9. #584
    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)
    your upload.php file has no "include '../dbconnect.php';" to refer to the database config file.

  10. #585
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the advice, I included the line as you can see below and made a couple of other corrections as I found some missing brackets.

    However, I still have the issue and when I eventually receive the 'cannot display page' error and refresh the page I receive the following error:-

    Fatal error: Maximum execution time of 30 seconds exceeded in /home/wardkcou/public_html/fotoscapes/admin/upload.php on line 27
    I don't understand why I am getting this error.

    Any ideas would be appreciated.

    Thanks.

    Here is the new code for my upload.php. Do I need to declare the $counter and have $counter++ in the while loop? Is this why I am getting the above error, I did try including these but the code still did not work.

    PHP Code:
    <?php
    include'../dbconnect.php';
    //$counter=1;

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

    //Fetch the image names array
    $photo_name=$_POST['photo_name'];

    //Fetch the image captions array
    $photo_caption=$_POST['photo_caption'];

    //set an array for file types
    $photo_types=array(
    'image/pjpeg'=>'jpg',
    'image/jpeg'=>'jpg',
    'image/gif'=>'gif',
    'image/bmp'=>'bmp',
    'image/x-png'=>'png'
    );

    //validate the uploaded file is an image
    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
                {
                
    $result_final.='File'.($counter+1).' was uploaded successfully.<br />';
                }
            }
        
    //$counter++;
        
    }

    //Add the new entry into the t_photos and fetch a unique ID
    mysql_query("
        INSERT INTO t_photos(
        photo_name,
        photo_caption,
        photo_filename,
        photo_cat
        ) VALUES (
        '"
    .$photo_name[$counter]."',
        '"
    .$photo_caption[$counter]."',
        '0',
        '"
    .$_POST['category']."'
        )
        "
    );

    $new_id=mysql_insert_id(); //new id generated

    //get the filetype of the uploaded file
    $filetype=$photos_uploaded['type'][$counter];

    //get the extension for the new name
    $extension=$photo_types[$filetype];

    //generate a new name
    $filename="$new_id.$extension";

    //update the filename in the database
    mysql_query("
        UPDATE t_photos SET
        photo_filename='
    $filename'
        WHERE photo_id='new_id'
        "
    );

    //store the images
    copy($photos_uploaded['tmp_name'][$counter],$images_dir.'/'.$filename);
    move_uploaded_file($photos_uploaded['tmp_name'][$counter],$images_dir.'/'.$filename);

    //create automatic thumbnails of images
    //determine if the imag is a tall one or wide one
    $sizegetimagesize($images_dir."/".$filename);

    //Wide image
    if($size[0]>$size[1])
    {
    $thumbnail_width=100;
    $thumbnail_height=(int)(100*$size[1]/$size[0]);
    }
    //Tall image
    else
    {
    $thumbnail_height=100;
    $thumbnail_width=(int)(100*$size[0]/$size[1]);
    }

    //set an array for file types
    $gd_function_suffix=array(
    'image/pjpeg'=>'jpg',
    'image/jpeg'=>'jpg',
    'image/gif'=>'gif',
    'image/bmp'=>'bmp',
    'image/x-png'=>'png'
    );

    //Get the name suffix on the basis of the mime type
    $function_suffix=$gd_function_suffix[$filetype];

    //Build the function name for ImageCreateFromSUFFIX
    $function_to_read='imagecreatefrom'.$function_suffix;

    //Build function name for ImageSUFFIX
    $function_to_write='image'.$function_suffix;

    //read the source file
    $source_handle=$function_to_read($images_dir.'/'.$filename);

    if(
    $source_handle)
        {
        
    //Create a blank image for the thumbnail
        
    $destination_handle=imagecreatetruecolor($thumbnail_width,$thumbnail_height);
        
    //resize it
        
    imagecopyresampled($destination_handle,$source_handle,0,0,0,0,$thumbnail_width,$thumbnail_height,$size[0],$size[1]);
        }

    //save the thumbnail
    $function_to_write($destination_handle,$thumbs_dir.'/tb_'.$filename);

    ?>

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

    Error with different image dimensions

    Hi,

    I seem to be able to upload images fine if there are of a certain size ie. photos of a 872x1536 dimension are OK but other photos I've tried of 640x421 or 2048x1536 dimension do not upload correctly. One photo and its thumbnail seems to upload fine but when I try 2 or more the second thumbnail is not created but both images are uploaded OK. Then when I try more than 2 photos upload.php gives a blank page.

    Any ideas??

  12. #587
    SitePoint Zealot hephaistion's Avatar
    Join Date
    Oct 2006
    Location
    Polis Chrysochous, Cyprus
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    puzzled. didn't think the original code was working with me. no error messages but the upload.php result came back with an empty (red x) image...and gave a positive result for file 1 being loaded. checked my image file, checked my db table: nothing! After wading through 10 pages of this thread I got it into my head to check for the thumbs. i was oddly relieved to find them under c:, but here are my problems:

    1. i'm using dreamweaver and want the images to end up in a subfolder of my images folder - how much of a path do i need? i'm assuming it should be everything under the sitename (ie images/properties/thumbs/filename ).

    2. my thumb was just named 'tb_' under c:.

    i think i should be able to work this out myself but nobody semed to have had these probs before. still, i would appreciate any input.

    cheers

    h.

  13. #588
    kapace
    SitePoint Community Guest
    WOW! its wonderful, (almost) everything works perfect :D

    i just don't know how to use those added functions... where do i put it and how do i call it ( Like through a button? )

  14. #589
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by renikdelan View Post
    Yeah I was looking for something like that. The only problem with that example is they shrink the original image in the php/html code for the thumbnail. If I/we can overcome that by drawing from the sql database, then damn.

    After thinking about it more, the SP Gallery thumbnails wouldnt be too bad to replace the array that they have. The more concerning part is getting the images that are of decent size to load at a fairly quick rate... perhaps if the fullsize images could be converted to SWF during the upload, then put a preloader for it on the page? I think I remember Infizi working on something like that, but havent seen him in a while.... any ideas?
    Hey guys. Long time! Yeh i been studing hard at uni so stopped PHPing as much. But annoying really. Ive started to have some free time, so geting back into it by launching a number of websites. Hopefully all done in the next 2 months (keep an eye on my tag).

    Anyhoo. I did what your after when i made a showcase website for my brother.

    I managed to get thumbnails to directly load the image. Is what i didnt implement but was hoping too last was making the thumbnails scrollable so it would be a gallery in a page.

    I did some searching and found the best method to do this was AJAX. After a little search i understood it, and implemented it.

    The code at the top is a fade method. Plus some other cool image functions i experimented with. I havent yet fully put this into the ajax script (Near bottom of the page), would be cool to have a fade! Its almost there too, just needs a few lines added if you want me to??

    Right, you need each link like this:

    HTML Code:
    <a href="javascript:swapImg('Img_ID_to_update', 'img_id_to_insert(fromDB)');><img src='thumbnail.....'></a>
    In the code you need to add the DIV id that the image will sit in. This, ideally is just a container for the image and nothing else.

    Also, you need a file called getimage.php which will get from the data base the details of the requested image, and passback in the form of echo-ing

    img_src|||img_width|||img_height

    if you look you can see how you could send more or less variables!

    As a final thought, you could also use the fade by calling swapImg in the 'id' variable for fade(), and do a bit of editing to make it change the src width and height.

    Hope you enjoy it, any quesitions just ask
    New Design - PHP Slowly flowing in!

    Infizi Studio's

  15. #590
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by animal777 View Post
    I cannot upload more than 6 pictures. Is this due to a MB limit or a time limit? How many can you upload?

    should I look at using this?

    set_time_limit(0);
    For anyone that is having a problem such as the one above.
    i.e. Only able to upload a few images no matter what the size of the files.

    This is NOT a configuration problem, it is an error in the coding in upload.php that is reflected in versions of PHP that do not support registered gobals.
    Problem: Improper use of the count function.

    the original upload.php code:
    PHP Code:
    // 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) ) 
    In order to properly count the $_FILES array you must use a statement such as:
    count($_FILES['photo_filename']['tmp_name'])

    The working upload.php code:

    PHP Code:
    // 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($_FILES['photo_filename']['tmp_name']) ) 

  16. #591
    Dan
    SitePoint Community Guest
    Hi... Ive been playing with these files, and looking to implement this on a site im messing with ATM... But i do have a question or two.

    The first regards the 'photos' folder. You have to leave the 'photos' folder chmod 777, from what I understand? Doesnt this leave that folder wide open, security-wise?

    Secondly, if so, is there a way to have upload.php change the folder permissions to 777 before the files are copied, then set it back to 644 afterwards?

    Im a relative PHP newbie (im upto about 13hrs now ;) ), so i hope what im asking makes sense!

    So far what i'm working to do is have the upload components in a password protected folder, accessing the DB with a usr that has full rights to the DB... The view components with be in a public folder, accessing the DB thru a usr with minimal rights. Whilst i havent finished this yet, i see no reason why it shouldnt play ball.

    Im just not sure about the photo's folder. I can of course just FTP in and change the folder permissions, but i am hoping to be able to make the upload as easy as possible for non-skilled ppl to use, whilst keeping the folder secure.

    Sorry if this is dumb and n00b... ;)

  17. #592
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when i execute the preupload file,
    the following output appears on ie explorer :


    $row[1]\n __HTML_END; } mysql_free_result($result); // Lets build the Image Uploading fields while($counter <= $number_of_fields) { $photo_upload_fields .= <<<__HTML_END Photo {$counter}: Caption: __HTML_END; $counter++; } // Final Output echo <<<__HTML_END
    Select Category $photo_category_list
    $photo_upload_fields

    __HTML_END; ?>


    anything that i have done wrongly ?
    could it be the preupload.php cannot execute in php5.1 version ?

    please help

  18. #593
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Dan View Post
    The first regards the 'photos' folder. You have to leave the 'photos' folder chmod 777, from what I understand? Doesnt this leave that folder wide open, security-wise?
    Yup

    Quote Originally Posted by Dan View Post
    Secondly, if so, is there a way to have upload.php change the folder permissions to 777 before the files are copied, then set it back to 644 afterwards?
    CHMOD the folder before the file is moved and then CHMOD it back again
    www.php.net/chmod

    Quote Originally Posted by Dan View Post
    Im a relative PHP newbie (im upto about 13hrs now ), so i hope what im asking makes sense!
    Dont worry, it does


    Quote Originally Posted by gohhs View Post
    when i execute the preupload file,
    the following output appears on ie explorer :


    $row[1]\n __HTML_END; } mysql_free_result($result); // Lets build the Image Uploading fields while($counter <= $number_of_fields) { $photo_upload_fields .= <<<__HTML_END Photo {$counter}: Caption: __HTML_END; $counter++; } // Final Output echo <<<__HTML_END
    Select Category $photo_category_list
    $photo_upload_fields

    __HTML_END; ?>


    anything that i have done wrongly ?
    could it be the preupload.php cannot execute in php5.1 version ?

    please help
    Can you post the code that this is contained in?
    what is before $row[1]\n __HTML_END;?

    It might be an idea to start a thread of your own about this, it might get answered more promptly

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

  19. #594
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when i execute the preupload file,
    the following output appears on ie explorer :


    $row[1]\n __HTML_END; } mysql_free_result($result); // Lets build the Image Uploading fields while($counter <= $number_of_fields) { $photo_upload_fields .= <<<__HTML_END Photo {$counter}: Caption: __HTML_END; $counter++; } // Final Output echo <<<__HTML_END
    Select Category $photo_category_list
    $photo_upload_fields

    __HTML_END; ?>


    anything that i have done wrongly ?
    could it be the preupload.php cannot execute in php5.1 version ?

    please help, my code ms below...



    <?php
    include 'config.inc.php';

    // initialization
    $photo_upload_fields = '';
    $counter = 1;

    $number_of_fields = 5;
    // If we want more fields, then use, 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 Image 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
    <html>
    <head>
    <title>Lets upload Photos</title>
    </head>
    <body>
    <form enctype="multipart/form-data"
    action="upload.php" method="post"
    name="upload_form">
    <table width="90&#37;" 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>
    </body>
    </html>
    __HTML_END;
    ?>

  20. #595
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody, help please, i stuck at page two, please refer to above post for my problem, thank you.

  21. #596
    SitePoint Member
    Join Date
    Mar 2007
    Location
    New York
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    larger pictures don't create thumbnails.

    Think someone mentioned this before, but I'm having a hard time getting large pictures to create thumbnails. They do indeed upload, but the thumbnail place holder will come up blank, and the the full size view is huge. These pictures are the size that of the output of a digital camera. But it's only about 1.78 MB (1,869,264 bytes).
    My phpini file says. max_filesize = 35000000. Isn't that 35MB. Is this wrong? If they upload then it can't be these settings, must be in the upload.php script? PLease help.
    efinity

  22. #597
    SitePoint Member llothcat's Avatar
    Join Date
    Jun 2006
    Location
    under my bed
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mighty buggy code there...eh?

  23. #598
    SitePoint Member
    Join Date
    Mar 2007
    Location
    New York
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it is, can you help? Someone mentioned the following, but eiter it's not working or I'm not implementing it correctly.

    Check the outcommings of your width and heights for large images.
    echo this image height and width :
    // Let's create a blank image for the image
    $destination_handle = ImageCreateTrueColor ( $image_width, $image_height );

    They should be bigger then 1 (not zero or negative) or the function will abort and do nothing.

    so add the following line
    $destination_handle = ImageCreateTrueColor ( $image_width, $image_height );
    die("width x height : ". $image_width." x ". $image_height);

    this die will echo the width and height and stop the script so that you can check the results, if the numbers are incorrect check you code again
    efinity

  24. #599
    mikebar
    SitePoint Community Guest
    it works, but if the picture has a higher resolution ex:1632 x 1224, the script doesn't creat the thumbnail , why?

  25. #600
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Nice work on the gallery script!

    I have it working great.

    I was wondering if anyone could help with the GD side of the script.

    I need the thumbnail images generated to be all of the same height, width as well but not so important.

    How would you go about that, also in such away that it doesnt distort tall images to much .. maybe a crop function?


    Thanks


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
  •