Results 1 to 5 of 5

Thread: PHP jpg

  1. #1
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default PHP jpg

    Hi

    How can I upload a JPG image and convertit into jpg (lower-case)?

    Thanks
    Last edited by lord22; 11-16-2009 at 05:58 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Upload it like normal, and just change the name when you are saving it to the server. This is very simple, and if you are only doing a certain name then it is just changing "JPG" to "jpg"... that's all.

    If you need more help, you will need to post more information.

    Please use a more descriptive title than "Help", etc. It will let us know what we are looking at, and make it easier to find the thread if we need to come back to help later.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    lord22 (11-16-2009)

  4. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    PHP Code:
    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
    <input name="uploaded" type="file" />
    <input type="hidden" name="sent" value="submitted" />
    <input type="submit" value="Upload File" />
    </form>
    <?php 
    if (isset($_POST['sent'])) {
        
    $file_name basename($_FILES['uploaded']['name']);
        
    $ext substr($file_name,strlen($file_name)-3,3);
        
    $lowercase_it explode($ext$file_name);
        
    $file_name $lowercase_it[0] . "jpg";
        
    $dir "images/";
        
    $put_it_up $dir $file_name;
        if (
    move_uploaded_file($_FILES['uploaded']['tmp_name'], $put_it_up)) {
                echo 
    "Uploaded";
            }
            else
            {
                echo 
    "Error ".$_FILES['uploaded']['error'];
            }
    }
    ?>

  5. The Following User Says Thank You to bluewalrus For This Useful Post:

    lord22 (11-16-2009)

  6. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    PHP Code:
    $text="sampleimage.JPG";
    $text=str_replace("JPG","jpg",$text); 
    or
    PHP Code:
    <?php
    $text
    ="http://www.animeviews.com/images/armitage.JPG";
    $text=explode('.',$text);
    $num=count($text);
    $num=$num-1;
    $text[$num]=strtolower($text[$num]);
    $text=implode('.',$text);
    echo 
    "$text";
    ?>
    To choose the lesser of two evils is still to choose evil. My personal site

  7. The Following User Says Thank You to james438 For This Useful Post:

    lord22 (11-16-2009)

  8. #5
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default

    Hi, sorry for the title, it was a mistake- I changed it.

    Thank you very much!

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
  •