Results 1 to 3 of 3

Thread: Save a file to server

  1. #1
    Join Date
    Nov 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Save a file to server

    Specifically a PNG (or, heck, any kinda image) file. Here's the situation...

    Using an online code example as a base, I've tweaked and made a simple PHP app that takes your latest tweet and puts it onto a .PNG image: http://quellman.info/ts/vk.php

    The problem is that little .php at the end. Some of the forums I frequent don't parse the .php as the PNG file it's creating. It sees I typed in .PHP and just spits out the BB code instead of the image file.

    I know I'm looking for server-side for this, and I'd have to have the applet run often enough to catch my new tweets, but is there any way I can have the PHP applet create the .PNG file on the server, so I can point the forum siggies to a .PNG instead of a .PHP? Is it even gonna be worth the effort? I'm no PHP or coding wizard, but I took a few college-level courses. If someone could even point me to the right library, function, whatever, I'm sure I can muddle through it. I just haven't been able to find said library, function, and/or whatever.

    also, I've already tried renaming my applet.php to applet.png. No dice. =P

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    We would need to see your code to be able to help you further, but what you could do is basically save the image that is being created by your php script, then add something like this everytime the file is run:

    Code:
    if (file_exists('image.png')) {
     unlink('image.png');
     //rest of save file code here
    }
    The other option is to use .htaccess to point a png file to the php script. An example of this would be:

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule image.png /yourscript.php
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jul 2009
    Location
    Coquitlam BC Canada
    Posts
    46
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    I guess you should save the file to the server first, then link to that file.:
    http://www.tizag.com/phpT/fileupload.php

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
  •