Jump to content

Beijufas

Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by Beijufas

  1. Hello all!  ;D

    Well my problem is I have some images on a database, and I want to rezise them on the fly, so I make some research and I have this code here:

    [code]
    <?php
    $id=$_GET['id'];
    $temp_endereco=$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
    $lastposc=strrpos($temp_endereco,'/');
    $endereco=substr($temp_endereco,0,$lastposc+1)."viewimg.php?id=".$id;


    $width = 40;
    $height = 30;
    $x = $width/2;
    $y = $height/2;

    $fp = fsockopen($endereco, 80, $errno, $errstr, 30);
    if (!$fp) {
      echo "$errstr ($errno)<br />\n";
    } else {

    $src = ImageCreateFromJpeg($fp);
    $tmb = ImageCreateTrueColor($width,$height);
    ImageCopy($tmb, $src, 0, 0, $x, $y, $width, $height);
    header('Content-type: image/jpeg');
    ImageJpeg($tmb, null, 100);
    ImageDestroy($src);
    ImageDestroy($tmb);
    ImageDestroy($thumb);
    }
    ?>
    [/code]

    The idea is to access the file viewimg.php that give me the image and them whit the ImageCreateFromJpeg and the other code resize the image and show it on a web page.

    The problem is that dosn't work  ???

    I also try to access the viewimg.php like this:
    [code]$src = ImageCreateFromJpeg($endereco);[/code]

    but it heve me an authorization error, I have made a search over the net and in a bugs page on php.net they say that I have to upgrade some dll's, but that is not a option becouse the server is a shared server.

    I hope that any one can help me!

    Thanks in advance for every body
×
×
  • 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.