Need a small php script - will pay $8 by paypal

Discussion in 'Programming' started by nals, Jan 12, 2008.

  1. #1
    I need a small php page done, simple script.

    Only 1 page, reading from an external folder eg: domainname.com/imagefolder. all images resize to 500px widht if its less than 500px ignore. and the height is 400px if its less ignore.

    auto border, and thin line for all images,

    ? and i dont know how the image extension going to read.. i want .jpg and .gif to be read.

    Please view the image for more infor..
    http://www.hfolder.com/nal/php_image_display_page.gif

    Need clear coded with comments , please answer here or you can pm me.

    Thank you,,
     
    nals, Jan 12, 2008 IP
  2. adrevol

    adrevol Active Member

    Messages:
    124
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    No need to pay amount , here is the code which can help you


    <?php
    session_start();
    
    $foldername="give path for your imagedirectory";
    
    $NBFile=0;
    
    if ($handle = opendir($foldername)) {
        while (false !== ($file = readdir($handle))) { 
            if ($file != "." && $file != "..") {
            if ( (substr($file, strlen($file)-3, 3)=="jpg" ) || ((substr($file, strlen($file)-3, 3)=="gif" ))){
                $FileArray[] = $file;
                $NBFile=$NBFile+1;
            }            
    
            }
        }
    }
    closedir($handle); 
    
    ?>
    <html><head></head><body>
    
    <Center><table><tr>
    <?php
    $NBPicswidth=400;
    $NBPicsheight=400;
    $NBPics=0;
    $NBFile=$NBFile-1;
    
    for ($i=0; $i<=$NBFile; $i++) {
    $Pic_Name1=$FileArray[$i];
    ?><td>
    <img border="1" src="<?php echo $Pic_Name1; ?>" align="middle" width="400" height="200">
    <p align="center" style="margin-top: -2; margin-bottom: 5"><?php echo $Pic_Name1; ?></td><?php
    $NBPics=$NBPics+1;
    
    if ( $NBPics==$NBPicswidth ) { $NBPics=0; ?><tr><?php }
    }
    ?>
    
    </table></body></html>
    Code (markup):
    ping me back if it helps

    happy coding .....
     
    adrevol, Jan 12, 2008 IP
    Agent_Dweeb, salaxzar and crashq7 like this.
  3. Agent_Dweeb

    Agent_Dweeb Peon

    Messages:
    5,607
    Likes Received:
    384
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    +REP for your AdRevol for providing this for free.
     
    Agent_Dweeb, Jan 12, 2008 IP
  4. Agomedia

    Agomedia Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    Thats very helpfull
     
    Agomedia, Jan 12, 2008 IP
  5. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    adrevol
    Thank you very much for your coding, Its very nice of you,,
    I think i made a mistake,,?
    the php file here http://www.hfolder.com/readimages/index.php (I have added this link for the folder path, inside u r coding $foldername="http://www.hfolder.com/myimages";
    my folder path is http://www.hfolder.com/myimages/

    But i m getting an error ? please help me.
    Thank you
     
    nals, Jan 12, 2008 IP
  6. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    Well I have made a change now, changes the path like this: $foldername="/home/hfolder/public_html/myimages"; and now i can view just empty boxes, and image dosent goto next line and no line :) what am i doing wrong here?
    Please help
     
    nals, Jan 12, 2008 IP
  7. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    Please someone help me
     
    nals, Jan 13, 2008 IP
  8. urlearn

    urlearn Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    i wrote a class for me and i can change it to meet your need but i want 15$
     
    urlearn, Jan 13, 2008 IP
  9. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    My budget is $8
     
    nals, Jan 13, 2008 IP
  10. pulikuttann

    pulikuttann Banned

    Messages:
    1,839
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    Thatz great dear!
     
    pulikuttann, Jan 13, 2008 IP
  11. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #11
    pulikuttan , the code not working, Thats y i m asking help,,
     
    nals, Jan 13, 2008 IP
  12. urlearn

    urlearn Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #12
    ok : i ll create it without money. :cool:
     
    urlearn, Jan 14, 2008 IP
  13. urlearn

    urlearn Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #13
    i sent pm
    See the final result
     
    urlearn, Jan 14, 2008 IP
  14. adrevol

    adrevol Active Member

    Messages:
    124
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #14
    <?php
    session_start();
    
    $foldername="imagesfol/";
    
    $NBFile=0;
    
    if ($handle = opendir($foldername)) {
        while (false !== ($file = readdir($handle))) { 
            if ($file != "." && $file != "..") {
            if ( (substr($file, strlen($file)-3, 3)=="jpg" ) || ((substr($file, strlen($file)-3, 3)=="gif" ))){
                $FileArray[] = $file;
                $NBFile=$NBFile+1;
            }            
    
            }
        }
    }
    closedir($handle); 
    
    ?>
    <html><head></head><body>
    
    <table><tr>
    <?php
    $NBPics=0;
    $NBFile=$NBFile-1;
    for ($i=0; $i<=$NBFile; $i++) {
    $Pic_Name1=$FileArray[$i];
    ?><tr><td>
    <p style="padding:5px 5px 5px 5px;border:1px solid #000000;background-color:#FFFFD9">
    <img border="1" src="<?php echo $foldername.$Pic_Name1; ?>" align="middle" width="150" height="100" >
    <p align="center" style="margin-top: -2; margin-bottom: 5"><?php echo $Pic_Name1; echo " (".ceil(filesize($foldername.$Pic_Name1) / 1024 )." KB)"; ?></p></td></tr><?php
    clearstatcache ();
    $NBPics=$NBPics+1;
    
    }
    ?>
    
    </table></body></html>
    Code (markup):
    i m absolutely sorry Nals, i did't logged in for last 2days .. i m absolutely sorry for the inconvinience, please check the refined code ,.. i bet this will surely work
     
    adrevol, Jan 14, 2008 IP
  15. adrevol

    adrevol Active Member

    Messages:
    124
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #15
    the problem with the old code was .. it was pointing to the root path while displaying the image ,, right click and go to properties then u will come to know..


    Just add the folder name before printing the image name that will work

    <img border="1" src="<?php echo $Pic_Name1; ?>" align="middle" width="150" height="100" >
    Code (markup):

    here if you oberser the image path will be pointed to root : modified code is

    <img border="1" src="<?php echo $foldername.$Pic_Name1; ?>" align="middle" width="150" height="100" >

    once again sorry for the delay ...
     
    adrevol, Jan 14, 2008 IP
  16. urlearn

    urlearn Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #16
    i finished coding
    that is the final result

    urlearn.com/listimages/myimages3.php
    urlearn.com/listimages/myimages.php
    urlearn.com/listimages/myimages2.php

    do u need any changes? :eek:
     
    urlearn, Jan 14, 2008 IP
  17. me4you

    me4you Well-Known Member

    Messages:
    1,989
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    155
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #17
    nice dealing, happy to read this thread. thanks.
     
    me4you, Jan 14, 2008 IP
  18. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #18
    Adrevol, Thank you very mcuh, Its working now, Thats ok for late :) I really appreciate your work.
     
    nals, Jan 14, 2008 IP
  19. nals

    nals Peon

    Messages:
    168
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #19
    nals, Jan 14, 2008 IP
  20. urlearn

    urlearn Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #20
    yes it is using css but for the background only

    this is the code:
    zshare.net/download/652835607e3d2e/
     
    urlearn, Jan 15, 2008 IP