Jump to content

zq29

Staff Alumni
  • Posts

    2,752
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by zq29

  1. Not as straight forward as you may think, you'll have to evaluate the type of file and the run the correct functions...

    [code]$pos = strrpos($image,".");
    $ext = substr($image,$pos);
    switch($ext) {
        case ".jpg":
             $src = ImageCreateFromJpeg($image);
             $dst = ImageCreate($tn_width,$tn_height);
             ImageCopyResized($dst, $src, 0, 0, 0, 0,
             $tn_width,$tn_height,$width,$height);
             header('Content-type: image');
             ImageJpeg($dst, null, -1);
             ImageDestroy($src);
             ImageDestroy($dst);
             break;
        case ".gif":
             $src = ImageCreateFromGif($image);
             $dst = ImageCreate($tn_width,$tn_height);
             ImageCopyResized($dst, $src, 0, 0, 0, 0,
             $tn_width,$tn_height,$width,$height);
             header('Content-type: image');
             ImageGif($dst, null, -1);
             ImageDestroy($src);
             ImageDestroy($dst);
             break;
    }[/code]Thats just a basic example, you'd make it a bit more efficient that that though ;)
  2. I'd rearrange the following:
    [code]if (isset($_POST['Submit'])) {
        // POST variables
        $section = $_POST['section'];
        $added_by = $_POST['added_by'];
        $headline = $_POST['headline'];
        $opening = $_POST['opening'];
        $body_text = $_POST['body_text'];

        if(empty($_POST['opening']) || empty ($_POST['body_text'])) {
            $error = "There is an error";
        } else {
            $query = "INSERT INTO cms_stories(section,added_by,headline,opening,body_text) VALUES
            ('$section','$added_by','$headline','$opening','$body_text')";
            $msg = "A new Story has been added to the database - Please Click
            <a href=\"http://index\">Here</a> to return to the main menu";
            //You'd probably want to unset all of the variables you created above here on success - unset();
        }
    }
    ?>[/code]
    Then to have the defaults on your inputs:
    [code]<input type="text" size="48" maxlength="255" name="headline" <?php if(isset($headline)) echo "value='$headline'"; ?>/>[/code]
    Hope this helps.
  3. Have you configured Apache to use PHP?

    You'll need to add the following lines within the relevent sections of httpd.conf:

    [code]ScriptAlias /php/ "path/to/php/"
    AddType application/x-httpd-php .php
    Action application/x-httpd-php /path/to/php/executable
    [/code]
  4. [!--quoteo(post=385439:date=Jun 18 2006, 11:01 PM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Jun 18 2006, 11:01 PM) [snapback]385439[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Really? This opens a whole new can of worms. Few questions for you.

    Which version of MacOS?
    Does your display adapter support core image?
    32 bit color depth?
    [/quote]
    OS X (10.4.6)
    No core image support (ATI Radeon 9200) - Running a non-Apple display, Iiyama 17" TFT.
    32 bit colour depth.

    Its not really high specced, its a PPC based MacMini (1.42GHz/1GB), my first Mac :)
  5. [!--quoteo(post=385414:date=Jun 18 2006, 09:22 PM:name=yarub)--][div class=\'quotetop\']QUOTE(yarub @ Jun 18 2006, 09:22 PM) [snapback]385414[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Oh. I knew that too. Haha. Thanks a lot for your help.
    [/quote]
    No problem [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
  6. You can either escape them with a backslash, or use their HTML entity instead.

    [code]INSERT INTO `table` (`id`,`something`) VALUES ('1','There\'s a hole in my pocket')[/code]
    [code]INSERT INTO `table` (`id`,`something`) VALUES ('1','There&#39:s a hole in my pocket')[/code]
    {Replace the colon with a semi-colon in &#39:)
  7. I think it's possible to do this with cURL (libcurl) and PHP. Search Google for "cURL tutorial" the official site should be at the top, or check out the curl functions in the PHP manual (I think there's some in there)
  8. You can get the time with the date() function, then edit the text file with fopen(), fwrite() and fclose(). Then you can ftp the file with ftp_connect(), ftp_login(), ftp_put() and ftp_close().
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.