Beijufas
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by Beijufas
-
-
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
ImageCreateFromJpeg From URL
in PHP Coding Help
Posted
the imagecreatefromstring(file_get_contents($endereco)); dosen't work becouse it have some problems acessing the file, but I do this:
imagecreatefromstring($image);
where $image is the data from the database and it works just fine ;D
Thanks a lot