SitePoint Sponsor

User Tag List

Page 16 of 31 FirstFirst ... 612131415161718192026 ... LastLast
Results 376 to 400 of 767
  1. #376
    Stuart
    SitePoint Community Guest
    It is riddled with errors. I got them worked out but it is a pain. Also, the way the article is written it is not clear what to do in the section about using Imagemagik or GD, etc.

  2. #377
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i m gettting error in the preupload page as

    Notice: Undefined index: number_of_fields in c:\program files\easyphp1-8\www\preupload.php on line 14

    Notice: Undefined variable: photo_category_list in c:\program files\easyphp1-8\www\preupload.php on line 22

    This is my code:
    <?php
    include("config.inc.php");

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

    // default number of fields
    $number_of_fields = 5;

    // 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
    <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%' border='0' align='center' style='width: 90%;'>
    <tr>
    <td>
    Select Category
    <select name='category'>
    $photo_category_list
    </select>
    </td>
    </tr>
    <tr>
    <td>
    <p>&nbsp;</p>
    </td>
    </tr>

    <!-Insert the photo fields here -->
    $photo_upload_fields

    <tr>
    <td>
    <input type='submit' name='submit' value='Add Photos' />
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    __HTML_END;
    ?>



    can anyone find the bug?
    -gaya

  3. #378
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    undefined index error

    I'm getting error as
    Notice: Undefined index: cid in c:\program files\easyphp1-8\www\viewgallery.php on line 8
    this is the first few lines of my script


    include("config.inc.php");

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

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

    can anyone tell me how to rectify the error.

    gthri

  4. #379
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    quick note about the undefined:

    I had this working fine on a linux server with php version 2.something.

    some stuff forced me to move to a new server running windows and php ver 5. all of a sudden all of the php on all the sites I had ever written started bugging out, the most prolific error being 'undefined index' or 'undefined variable' It's been driving me nuts! I've had some help from some more experienced programmers, and they fixed some of the errors - kind of.... said it has to do with the way you reference variables in requests, basically changed most variables within query strings from $request = $var to $request = $_REQUEST["var"]

    this fixed some, but not all errors, but it also created a few new errors... anyways, I don't expect this post to solve anything, but maybe will help a more knowledgable person in the right direction. seems like this thing was written in an older version of php and uses things that, sadly, are no longer supported by recent versions of php.

  5. #380
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Retain the same file name as in my directory

    When uploading this upload.php everything worrks fine but i would like to retain the same file name as it is in my directory(eg.test1.gif,test2.gif etc) instead of file 1 added.

    how can i change the code.
    this is my code
    <?php
    include("config.inc.php");
    //include("design.inc.php");
    include("security.inc.php");

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

    // List of our known photo types
    $known_photo_types = array(
    'image/pjpeg' => 'jpg',
    'image/jpeg' => 'jpg',
    'image/gif' => 'gif',
    'image/bmp' => 'bmp',
    'image/x-png' => 'png');

    // GD Function Suffix List
    $gd_function_suffix = array(
    'image/pjpeg' => 'JPEG',
    'image/jpeg' => 'JPEG',
    'image/gif' => 'GIF',
    'image/bmp' => 'WBMP',
    'image/x-png' => 'PNG');

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

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

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

    @mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" );
    $new_id = mysql_insert_id();
    $filetype = $photos_uploaded['type'][$counter];
    $extention = $known_photo_types[$filetype];
    $filename = $new_id.".".$extention;

    @mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );

    // Store the orignal file
    copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename);

    // Let's get the original image size

    $size = GetImageSize( $images_dir."/".$filename );

    // First Create Thumbnail!
    // Thumbnail Settings
    $Config_tbwidth_wide = 150; // width of wide image
    $Config_tbheight_wide = 125; // height of wide image

    $Config_tbwidth_tall = 125; // width of tall image
    $Config_tbheight_tall = 150; // height of tall image

    // The Code
    if($size[0] > $size[1]){
    $thumbnail_width = $Config_tbwidth_wide;
    $thumbnail_height = (int)($Config_tbwidth_wide * $size[1] / $size[0]);

    if($thumbnail_height > $Config_tbheight_wide){
    $thumbnail_height = $Config_tbheight_wide;
    $thumbnail_width = (int)($Config_tbheight_wide * $size[0] / $size[1]);
    }
    }else{
    $thumbnail_width = (int)($Config_tbheight_tall * $size[0] / $size[1]);
    $thumbnail_height = $Config_tbheight_tall;

    if($thumbnail_width > $Config_tbwidth_tall){
    $thumbnail_width = $Config_tbwidth_tall;
    $thumbnail_height = (int)($Config_tbwidth_tall * $size[1] / $size[0]);
    }
    }

    // Build Thumbnail with GD 2.x.x, you can use the other described methods too
    $function_suffix = $gd_function_suffix[$filetype];
    $function_to_read = "ImageCreateFrom".$function_suffix;
    $function_to_write = "Image".$function_suffix;

    // Read the source file
    $source_handle = $function_to_read ( $images_dir."/".$filename );

    if($source_handle){
    // Let's create a blank image for the thumbnail
    $destination_handle = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height );

    // Now we resize it
    ImageCopyResampled( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
    }

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

    // .................................................................................
    // Lets resize the image if its width is greater than 500 pixels
    // Resized image settings
    if ($size[0] > '500'){
    $Config_width_wide = 500; // width of wide image
    $Config_height_wide = 475; // height of wide image

    $Config_width_tall = 475; // width of tall image
    $Config_height_tall = 500; // height of tall image

    // The Code
    if($size[0] > $size[1]){
    $image_width = $Config_width_wide;
    $image_height = (int)($Config_width_wide * $size[1] / $size[0]);

    if($image_height > $Config_height_wide){
    $image_height = $Config_height_wide;
    $image_width = (int)($Config_height_wide * $size[0] / $size[1]);
    }
    }else{
    $image_width = (int)($Config_height_tall * $size[0] / $size[1]);
    $image_height = $Config_height_tall;

    if($image_width > $Config_width_tall){
    $image_width = $Config_width_tall;
    $image_height = (int)($Config_width_tall * $size[1] / $size[0]);
    }
    }

    // Build image with GD 2.x.x, you can use the other described methods too
    $function_suffix = $gd_function_suffix[$filetype];
    $function_to_read = "ImageCreateFrom".$function_suffix;
    $function_to_write = "Image".$function_suffix;

    // Read the source file
    $source_handle = $function_to_read ( $images_dir."/".$filename );

    if($source_handle){
    // Let's create a blank image for the image
    $destination_handle = ImageCreateTrueColor ( $image_width, $image_height );

    // Now we resize it
    ImageCopyResampled( $destination_handle, $source_handle, 0, 0, 0, 0, $image_width, $image_height, $size[0], $size[1] );
    }

    // Let's save the image
    $function_to_write( $destination_handle, $images_dir."/".$filename, 90 );
    ImageDestroy($destination_handle );

    }

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

    }
    }
    $counter++;
    }

    // Print Result
    echo <<<__HTML_END

    <html>
    <head>
    <title>Photos uploaded</title>
    </head>
    <body>
    $design_header<br>
    $result_final<br>
    <a href="adminindex.php">Back to Administration Page</a><br>
    <a href="logout.php">Logout of Administration Area</a><br>
    $design_footer
    </body>
    </html>

    __HTML_END;
    ?>

  6. #381
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do i code it if i want to add new users in the admin page or delete the existing users from the database.

    -gthri

  7. #382
    SitePoint Member
    Join Date
    May 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, this script is awesome. Just what I've been looking for.

    It's just one little thing I would like to have. Clicking the thumbnails should display the "full version" of the picture in the same window. No redirection to empty page with "full-version picture".

    A click on a thumb will show the "full version" in the same window and still show the thumbs at the bottom. Is this possible?

    Thanx in advance.

  8. #383
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oggah
    Hi, this script is awesome. Just what I've been looking for.

    It's just one little thing I would like to have. Clicking the thumbnails should display the "full version" of the picture in the same window. No redirection to empty page with "full-version picture".

    A click on a thumb will show the "full version" in the same window and still show the thumbs at the bottom. Is this possible?

    Thanx in advance.
    like this?

    http://anglersforchrist.com/christianangler/gallery.php

  9. #384
    It's been real... Forbes's Avatar
    Join Date
    Dec 2004
    Location
    Yorkshire, England
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Nearly, but really not quite there...

    Sadly, this tutorial is an opportunity wasted.

    Rather than keeping the structure and syntax simple and approachable for a broad range of developers, the author instead chose to couch syntax by building functions up dynamically rather than calling them directly.

    I'm pretty sure some could argue that such a practice makes for a 'clean' application. I say that such a refinement is an unexpected departure from what otherwise could have been a good tutorial, making for largely impenetrable reading that will sadly deter beginners and maybe even a few intermediates alike.

    Also, some of the comments are oddly placed and with such a maddeningly narrow content area because of the plethora of adverts, the code becomes largely unreadable and discontinuous.

    After four years of developing, this week has been my first serious foray into generating images dynamically, and this tutorial has proved to be frustratingly difficult to digest.

    Clearly a revision is required...

  10. #385
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi - Implemented in an alpha version of my fully customisable version (soon to be released to SP members!!!!) www.andyguard.com



    Quote Originally Posted by oggah
    Hi, this script is awesome. Just what I've been looking for.

    It's just one little thing I would like to have. Clicking the thumbnails should display the "full version" of the picture in the same window. No redirection to empty page with "full-version picture".

    A click on a thumb will show the "full version" in the same window and still show the thumbs at the bottom. Is this possible?

    Thanx in advance.
    New Design - PHP Slowly flowing in!

    Infizi Studio's

  11. #386
    Vega Von
    SitePoint Community Guest
    This is a very good base in my opinion. Sure it will take some tweaking like using. I would suggest using the imagecreatetruecolor and imagecopyresampled functions to get the color right for the thumbs. Very good base. When I finish tweaking and cleaning up the code I will have a download for all on my site.

  12. #387
    Jon
    SitePoint Community Guest
    I would have to agree with the first comment. You know your php very well and you are able to write a good script that is dynamic and useful... but god, this has got to be one of the worst tutorials I've ever read.

  13. #388
    SitePoint Enthusiast drewf's Avatar
    Join Date
    Mar 2002
    Location
    Calgary, AB
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Infizi, I have not been on here for months and months...but I finally read your post.

    I visited your site below in hope of seeing what you have done with the script. I see your ambitious project got off the ground ok but kind of got off track too (there has been nothing done since Feb), your intentions were good though and I think its a great idea. Kudos for trying! I would still like to participate if you resurect it. I appreciate you mentioning my name on there too but its not necessary. Since this is a collaboration of code between many people, I think its best that we just build on it as a group.

    Honestly, I have been kind of dissapointed with this script lately in general because its difficult to get the gallery to look decent or modify this script (customize it with more detail) because it builds its functions dynamically...spitting out a single $result_final variable at the end of the code with all the <TR> and <TD> tags imbedded in the PHP code. Anyhow its a mess in my opinion and I am trying to figure out how to clean it all up. I am still a PHP/MySQL newbie and its kind of frustrating to figure all this out but I have a rekindled coding spirit these days...

    I don't particularily like here doc syntax either as switching in and out of PHP mode is easier in my opinion to keep the HTML separate from the PHP code...what are your thoughts? It could just be because I am still a rookie but this is my preference...

    Hope to see you back on here. I wish others would post their code to the forum too.

    =
    Quote Originally Posted by Infizi
    yes drewf,
    This will be a large scale collaberation organised by me! Im gonna throw up a small site so people can see it all in one, the suggestions, progress, files, list of "collaberators", and a few help files about the installation and admin interface!

    Plus a few customisation tutorials etc etc etc

    Keep an eye on www.xsproject.info, i have been meaning to make ym site for ages and post all my scripts on there, so tha will be on there first and gimma a reason to get down to work!!!
    Drew

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

  14. #389
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get an error "Fatal error: Call to undefined function: imagegif() in c:\appserv\www\photogallery\upload.php on line 84" ?

    PHP Code:
                    // Let's save the thumbnail
                    
    $function_to_write$destination_handle$images_dir."/tb_".$filename );
                    
    ImageDestroy($destination_handle );
                    
    // 
    What could be wrong ?

    * Edit nevermind it must be the gif image thing :'(
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  15. #390
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm i am trying to include the pre_upload.php and upload.php in another file and then it says...

    Warning: copy(photos/25.jpg): failed to open stream: No such file or directory in c:\appserv\www\faceup\admin\com_models\upload2.php on line 51

    Is it not possible to include these files, will the post array get lost somehow? I do have a tmp file when i print $photo_filename[0]; ?

    looool nevermind, i need to stop sittng behind the pc it rots my brain it was just because the dir is in another place now
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  16. #391
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm the caption only saves the first letter, the table format is correct text? Does anybody know why it only saves one letter ? :s

    that is strange it does not even save the correct letter but a when it starts with a t ?
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  17. #392
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey man,

    I havent really been around alot either, but finished my exams now, and ive learnt CSS so im thinking i may do the final script using CSS to make it easy to change the design. My current script relys heavily on templates, which is great in one sense, but i think allowing total CSS customisation will make each design as different as those displayed at csszengarden

    So if you have msn please add me in dude, as i now have free time im really gonna get cracking on the plans i made the first half of the year. I also have about 10 half made websites to finish off!!!!!! Keep me updated, and anyone else who is seriously interested in writing this final for the PHP gallery please also add me into msn, (_matrix_ i think, and there are a few others that PM me every so often!!!!)

    Im back, and got a buring ambition to get this damn thing completed!!

    Rob aka Infizi

    -- Check my pro for my MSN, or PM me
    Quote Originally Posted by drewf
    Hello Infizi, I have not been on here for months and months...but I finally read your post.

    I visited your site below in hope of seeing what you have done with the script. I see your ambitious project got off the ground ok but kind of got off track too (there has been nothing done since Feb), your intentions were good though and I think its a great idea. Kudos for trying! I would still like to participate if you resurect it. I appreciate you mentioning my name on there too but its not necessary. Since this is a collaboration of code between many people, I think its best that we just build on it as a group.

    Honestly, I have been kind of dissapointed with this script lately in general because its difficult to get the gallery to look decent or modify this script (customize it with more detail) because it builds its functions dynamically...spitting out a single $result_final variable at the end of the code with all the <TR> and <TD> tags imbedded in the PHP code. Anyhow its a mess in my opinion and I am trying to figure out how to clean it all up. I am still a PHP/MySQL newbie and its kind of frustrating to figure all this out but I have a rekindled coding spirit these days...

    I don't particularily like here doc syntax either as switching in and out of PHP mode is easier in my opinion to keep the HTML separate from the PHP code...what are your thoughts? It could just be because I am still a rookie but this is my preference...

    Hope to see you back on here. I wish others would post their code to the forum too.

    =
    New Design - PHP Slowly flowing in!

    Infizi Studio's

  18. #393
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    lalal
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Apologies if this has already been covered (16 pages is a lot to read through ! I got to 5 before jumping to the end) but I don't think it has going by the last script post here.

    The file validation (as seen on this page http://www.sitepoint.com/article/php...stem-minutes/3) is inherently flawed in the fact no validation is done at all. The file type you are checking against is a user set (browser) variable and can be anything. This means if you have this script publically available anyone can upload anything and of course this is bad.

    A much better way to check the file would be a regular expression check on the extension and use of exif_imagetype().

  19. #394
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also sometimes it says with jpg that it is not a valid file and then it still insert it into the database ????
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  20. #395
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i received an error when i clicked on Add Photo button:

    Fatal error: Call to undefined function ImageCreateFromJPEG()

    when i looked at the source code, it says that:

    <!-Insert the photo fields here -->
    $photo_upload_fields

  21. #396
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get the following errors:

    Warning: copy(photos/14.jpg) [function.copy]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\photos\upload.php on line 51

    Warning: getimagesize(photos/14.jpg) [function.getimagesize]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\photos\upload.php on line 54

    Warning: Division by zero in C:\Program Files\xampp\htdocs\photos\upload.php on line 62

    Warning: imagecreatefromjpeg(photos/14.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\photos\upload.php on line 73

    Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\Program Files\xampp\htdocs\photos\upload.php on line 85

    Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\Program Files\xampp\htdocs\photos\upload.php on line 86


    this is the code from upload.php
    <?php
    include'config.inc.php';

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

    // List of our known photo types
    $known_photo_types = array(
    'image/pjpeg' => 'jpg',
    'image/jpeg' => 'jpg',
    'image/gif' => 'gif',
    'image/bmp' => 'bmp',
    'image/x-png' => 'png'
    );

    // GD Function List
    $gd_function_suffix = array(
    'image/pjpeg' => 'JPEG',
    'image/jpeg' => 'JPEG',
    'image/gif' => 'GIF',
    'image/bmp' => 'WBMP',
    'image/x-png' => 'PNG'
    );

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

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

    while( $counter <= count($photos_uploaded) )
    {
    if($photos_uploaded['size'][$counter] > 0)
    {
    if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))
    {
    $result_final .= "File ".($counter+1)." is not a photo<br />";
    }
    else
    {
    mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" );
    $new_id = mysql_insert_id();
    $filetype = $photos_uploaded['type'][$counter];
    $extention = $known_photo_types[$filetype];
    $filename = $new_id.".".$extention;

    mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );

    // Store the orignal file
    copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename);

    // Let's get the Thumbnail size
    $size = GetImageSize( $images_dir."/".$filename );
    if($size[0] > $size[1])
    {
    $thumbnail_width = 100;
    $thumbnail_height = (int)(100 * $size[1] / $size[0]);
    }
    else
    {
    $thumbnail_width = (int)(100 * $size[0] / $size[1]);
    $thumbnail_height = 100;

    }

    // Build Thumbnail with GD 1.x.x, you can use the other described methods too
    $function_suffix = $gd_function_suffix[$filetype];
    $function_to_read = "ImageCreateFrom".$function_suffix;
    $function_to_write = "Image".$function_suffix;

    // Read the source file
    $source_handle = $function_to_read ( $images_dir."/".$filename );

    if($source_handle)
    {
    // Let's create an blank image for the thumbnail
    $destination_handle = ImageCreate ( $thumbnail_width, $thumbnail_height );

    // Now we resize it
    ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
    }

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

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

    // Print Result
    echo <<<__HTML_END

    <html>
    <head>
    <title>Photos uploaded</title>
    </head>
    <body>
    $result_final
    </body>
    </html>

    __HTML_END;
    ?>

  22. #397
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uh yah can you tell I am not a programmer? note to self make sure you have a file to upload to in the same directory folder as the other php files and make sure it has the same name in the include php.

    another question the thumbs don't look very clear is there any way to increase quality?

  23. #398
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sounds like a phpini issue safe mode i believe should be off check the tutorial

  24. #399
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Costa Rica
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can only upload 6 files at a time

    I am using the code that was provided by Drew F as a zip package on this forum some time ago. It works fine except for one problem: It will only upload 6 images at a time. It will generate as many upload fields as I specify, but if for example I use 10 upload fields, it still will upload only 6 of the images. This problem was reported in three previous posts but the only solution offered was to check the php.ini settings.

    That is not the problem. I have post_max_filesize set to 50M and upload_max_filesize set to 50M, and the Apache directive limiting filesize disabled. All to no avail.

    It does not depend on filesize. Whether I try uploading 10M files, or 10Kb files, the result is the same: It will upload exactly six files. I have tried it on three different servers with the same result.
    Can anyone shed any light on this?

    P.S. I have created a version that uses ImageMagick, and a version that watermarks the images, and a version that allows video upload and display (all with the above mentioned problem). I am happy to share my experience with anyone interested in one of those features.

  25. #400
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello everybody.

    There are two things I would like to do:

    1) I would like to show 10 photos by page and make a navigation for thumbnails in each category (whith links NEXT and PREVIOUS).
    2) Limit the size of uploaded photos (for exemple, each photo not bigger than 300Ko).

    Anyone knows how to do that?

    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
  •