Jump to content

Steffen

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Posts posted by Steffen

  1. I have a input form with year, month and day input fields. I convert it to a timestamp (with the new safestrotime function) to store it in the database (as VARCHAR). Then I select it and parse it with the date function...so it should return the date again...

    thx a lot
  2. Yes, i tried one of those functions before but i had a problem with date(). so, now i have the same problem. One I try to convert the timestamp to a date it results in 19 january 2038 (= maximum value -> cfr php.net)

    How can i solve the date function then?

    Thx a lot!
  3. Hi all

    I've been searching for one hour now on the internet for an easy solution for strotime in combination with dates prior to 1970 (on Windows platform).
    So, on my localhost strotime("1950-06-02") returns -1 instead of a timestamp.

    I know there is a solution...I just can't find it:(

    Grtz and thx
  4. I have found a tutorial to create thumbnails on the fly. This is the code:

    [code]
    # Constants
    define(IMAGE_BASE, './images');
    define(MAX_WIDTH, 200);
    define(MAX_HEIGHT, 200);

    function show_thumbnail($image, $dirname)
    {

    # Get image location
    $image_path = IMAGE_BASE . "/" . $dirname . "/" . $image;

    # Load image
    $img = null;
    $ext = strtolower(end(explode('.', $image)));
    if ($ext == 'jpg' || $ext == 'jpeg') {
        $img = @imagecreatefromjpeg($image_path);
    } else if ($ext == 'png') {
        $img = @imagecreatefrompng($image_path);
    # Only if your version of GD includes GIF support
    } else if ($ext == 'gif') {
        $img = @imagecreatefrompng($image_path);
    }

    # If an image was successfully loaded, test the image for size
    if ($img) {

        # Get image size and scale ratio
        $width = imagesx($img);
        $height = imagesy($img);
        $scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);

        # If the image is larger than the max shrink it
        if ($scale < 1) {
            $new_width = floor($scale*$width);
            $new_height = floor($scale*$height);

            # Create a new temporary image
            $tmp_img = imagecreatetruecolor($new_width, $new_height);

            # Copy and resize old image into new image
            imagecopyresized($tmp_img, $img, 0, 0, 0, 0,
                             $new_width, $new_height, $width, $height);
            imagedestroy($img);
            $img = $tmp_img;
        }
    }# Create error image if necessary
    if (!$img) {
        $img = imagecreate(MAX_WIDTH, MAX_HEIGHT);
        imagecolorallocate($img,0,0,0);
        $c = imagecolorallocate($img,70,70,70);
        imageline($img,0,0,MAX_WIDTH,MAX_HEIGHT,$c2);
        imageline($img,MAX_WIDTH,0,0,MAX_HEIGHT,$c2);
    }

    # Display the image
    header("Content-type: image/jpeg");
    imagejpeg($img);

    }
    [/code]

    I have a page of large images, and i want to make thumbnails of them, without creating a new file. Just to decrease the file size.
    The problem is, when I try this for one image:
    For example:
    show_thumbnail("Foto 005.jpg", "test2");

    I get this output:
    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\speelschare\index.php:23) in c:\program files\easyphp1-8\www\speelschare\sources\fotos\test2.php on line 59
    ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC    $.' ",#(7),01444'9=82<.342ÿÛC  2!!22222222222222222222222222222222222222222222222222ÿÀÈÈ"ÿÄ ÿĵ}!1AQa"q2?‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2?B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ ?ùþŠ( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( ÿÙ
    [/quote]

    I wanted to put the header on line 1, but the problem is that my page is not only one image, but also html and flash...

    Could anyone help me plz?
×
×
  • 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.