VISIT OUR NEW SISTER SITE
Introducing PosterMason! It's like VGBA, but for posters. Check it out and start submitting your work.

Results 1 to 14 of 14

Thread: Auto-Updating Box Signature Tutorial

  1. #1

    Default Auto-Updating Box Signature Tutorial

    Automatic Updating Box Signature Tutorial
    I have created this PHP code with some friends help to automatically update your signature with your latest box at the click of a button.


    Requirements

    • A Server
    • My PHP script


    STEP 1

    Take this PHP code and paste it into a text document.

    PHP Code:
    <?php

        
    // Get a file into an array.  In this example we'll go through HTTP to get
        // the HTML source of a URL.
        
    $lines file('http://www.vgboxart.com/author/XXXXXXXXXXX/');

        
    // variable to hold the line number we want to start searching from
            
    $startingLine "";

            
    // our search term to find the starting line
            
    $regex '/<div class="headerLarge">Latest Boxes/';

            
    // Loop through our array, show HTML source as HTML source; and line numbers too.
        
    foreach ($lines as $line_num => $line) {
                    if (
    preg_match($regex$line)) {
                            echo 
    "FOUND STARTING POINT: Line #<b>{$line_num}</b> : " htmlspecialchars($line) . "<br />\n";
                            
    // set the variable to this line number
                            
    $startingLine $line_num;
                    }
        }


            
    $imageRegex '/(\/.*\.(jpg|png|gif|bmp))/i';

            
    //loop thru the lines again, but this time, starting at out line number and search for the first image
            
    for ($i $startingLine;$i count($lines);$i++) {
                    if (
    preg_match($imageRegex$lines[$i], $matches)) {
                            echo 
    "FOUND: ";
                            echo 
    "<b>"$matches[0] ."</b><p>";

                            
    //show the picture
                            
    echo '&lt;img src="http://www.vgboxart.com'.$matches[0].'"&gt;<p>';
                            echo 
    '<img src="http://www.vgboxart.com'.$matches[0].'">';

                            
    //put it on our server
                            
    $url "http://www.vgboxart.com".$matches[0];
                            
    $destination=fopen("myImage.jpg","w");
                            
    $source=fopen($url,"r");
                            while (
    $a=fread($source,1024)) fwrite($destination,$a);
                            
    fclose($source);
                            
    fclose($destination);

                            echo 
    '&lt;img src="myImage.jpg"&gt;<p>';
                            echo 
    '<img src="myImage.jpg">';

                            
    // we found our string so stop the loop, we don't need to keep looking
                            
    return false;
                    }
            }


    ?>

    STEP 2


    Change the "XXXXXXXXXXX" on line 5 to your username.


    Step 3

    Click on file then click on save as then save it as "vgboxart.php".



    Step 4

    Upload "vgboxart.php" to your server.



    Step 5

    After it is uploaded all you have to do it open it up in the web browser, the script will run and the file "myimage.jpg" will be saved onto your server.



    Step 6

    Go to your settings and then the signature section. Paste this into your signature.
    PHP Code:
    [URL=http://www.vgboxart.com/author/yyyyyy/][IMG]http://xxxxxxxxxxxx/myimage.jpg[/IMG][/URL] 


    Step 7

    Replace "yyyyyy" with your username. Replace "xxxxxxxxxxxx" with your website.



    Step 8

    Now, every time you create a new box and upload it all you have to do is open it up in the web browser, the script will run and the file "myimage.jpg" will be re-saved onto your server along with the new boxart.



    Credits

    The guys over at the phpfreaks.

  2. #2
    Join Date
    Jul 2008
    Location
    Watermelon Land
    Posts
    6,220

    Default

    You don't really need a server for something like this though, that's too complicated. Something easy like a free dropbox account would do just fine. Nice job though, pretty cool.
    Quote Originally Posted by Mub View Post
    jesus its like a book telling me i can't read the other half because i bought it in a yard sale

  3. #3
    Join Date
    May 2009
    Location
    Planet Veget- ooooooohhhh...
    Posts
    3,652

    Default

    tl;dr

  4. #4
    Join Date
    Jul 2008
    Location
    Watermelon Land
    Posts
    6,220

    Default

    Quote Originally Posted by Ronthis the Werewolf View Post
    tl;dr
    Then don't post -_-
    Quote Originally Posted by Mub View Post
    jesus its like a book telling me i can't read the other half because i bought it in a yard sale

  5. #5

    Default

    Quote Originally Posted by Ronthis the Werewolf View Post
    tl;dr
    Yeah, that really isn't an appropriate comment.

  6. #6
    Join Date
    Aug 2010
    Location
    Harajuku
    Posts
    3,590

    Default

    Quote Originally Posted by Ronthis the Werewolf View Post
    tl;dr
    Are you trying to be funny? It's not working.

  7. #7
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    1,688

    Default

    "Too long didn't read"

    Ah man, I read the whole thing and was worth it. I'll give a shot anyway, if i'ts not work out (probably because I don't know PHP at all) I'll try the dropbox account because it sounds easier...

    EDIT: Ok I'm stuck on the "upload to your server part". What's the server you use?
    Last edited by Higashi89; 03-16-2012 at 06:19 PM.

    More boxes: Click here for Portfolio | Xbox Live - Steam - PSN ID: AlexHidanBR

  8. #8
    Join Date
    Jul 2008
    Location
    Watermelon Land
    Posts
    6,220

    Default

    Quote Originally Posted by Higashi89 View Post
    "Too long didn't read"

    Ah man, I read the whole thing and was worth it. I'll give a shot anyway, if i'ts not work out (probably because I don't know PHP at all) I'll try the dropbox account because it sounds easier...

    EDIT: Ok I'm stuck on the "upload to your server part". What's the server you use?
    Instead of using a server, you can use basically any cloud storage service, like DropBox.
    Quote Originally Posted by Mub View Post
    jesus its like a book telling me i can't read the other half because i bought it in a yard sale

  9. #9
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    1,688

    Default

    Quote Originally Posted by Spiderpig24 View Post
    Instead of using a server, you can use basically any cloud storage service, like DropBox.
    I know, I read your post... but I want to try his method first

    More boxes: Click here for Portfolio | Xbox Live - Steam - PSN ID: AlexHidanBR

  10. #10
    Join Date
    May 2009
    Location
    Planet Veget- ooooooohhhh...
    Posts
    3,652

    Default

    Quote Originally Posted by Ronthis the Werewolf View Post
    tl;dr
    Wow, I posted that? o.o

  11. #11
    Join Date
    Jul 2008
    Location
    Watermelon Land
    Posts
    6,220

    Default

    Quote Originally Posted by Higashi89 View Post
    I know, I read your post... but I want to try his method first
    Well, for the server idea you will need to have a domain and server set up.
    Quote Originally Posted by Mub View Post
    jesus its like a book telling me i can't read the other half because i bought it in a yard sale

  12. #12
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    1,688

    Default

    Quote Originally Posted by Spiderpig24 View Post
    Well, for the server idea you will need to have a domain and server set up.
    OK, how I do that? #imsonoob

    More boxes: Click here for Portfolio | Xbox Live - Steam - PSN ID: AlexHidanBR

  13. #13
    Join Date
    Jan 2009
    Location
    Portland, OR
    Posts
    5,091

    Default

    Quote Originally Posted by Higashi89 View Post
    OK, how I do that? #imsonoob
    Dude seriously. Just use Dropbox.

  14. #14
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    1,688

    Default

    Quote Originally Posted by stevencho View Post
    Dude seriously. Just use Dropbox.
    *sigh* fine...

    EDIT: I'm stuck in step 5. I tried to open "vgboxart.php" on firefox, but no "myimage" was saved in my dropbox folder...
    Last edited by Higashi89; 03-18-2012 at 11:29 AM.

    More boxes: Click here for Portfolio | Xbox Live - Steam - PSN ID: AlexHidanBR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •