Beijufas Posted September 16, 2006 Share Posted September 16, 2006 Hello all! ;DWell 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 Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted September 16, 2006 Share Posted September 16, 2006 you could try imagecreatefromstring(file_get_contents($endereco)); Quote Link to comment Share on other sites More sharing options...
Beijufas Posted September 16, 2006 Author Share Posted September 16, 2006 Thanks a lot!!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 ;DThanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.