Jump to content

Imposible Question?


Dobakat

Recommended Posts

For starters, I would like to clarify that I understand what I want might no be possible and that I would not get dissapointed. Secondly, I understand it might be very hard, but I am willing to try it.

Here is the scoop:

I have my website in which I want to display an image that is roughly around 1000x1000 pixels. This picture is the 'map'. Each members on my site have a position, lets say 500,500. I want to display the same image, in the 100x100 pixel box. The only parts I would like to show are from 450,450 to 550,550. This being x,y of pixels.  I know how to make it get the users position, but not how to only show a 10000pixel square(the 100x100 box) with the user's position as center, without any shrinkings.

I don't if this is possible with palne html and php code. I understand that it might use another coding language, if it does, let me know which one it is.
Link to comment
https://forums.phpfreaks.com/topic/34496-imposible-question/
Share on other sites

Hi,

I use GD to handle image resizing on my site.  I've found it to be really good, but it can be a bit memory hungry with larger images.

If you have problems, you might need to ini_set('memory_usage', xxM); where xx = the max amount of memory your page consumes.
If you're on a shared server you might not be able to ini_set('memory_usage)

GD tends do die rather quietly we've found so if you find you're getting a blank page i'd check the memory usage first :-)

Depending on the version of php you've got you might be able to user memory_get_usage or memory_peak_usage()

Cheers

Matt
Link to comment
https://forums.phpfreaks.com/topic/34496-imposible-question/#findComment-162497
Share on other sites

I always had a problem with headers, and this is no exception.
My function:
[code] function getMaps($x,$y ){
//Get srcx and srcy
$src_x=$x-5;
$src_y=$y-5;
$src_image="images/ice.jpg";
header('Content-type: image/jpeg');
$dst_image= imagecreatetruecolor(200,200);
$dst_x=0;
$dst_y=0;
$dst_h=200;
$dst_w=200;
$src_w=10;
$src_h=10;
$image = imagecreatefromjpeg($src_image);
imagecopyresampled ($dst_image, $image, $dst_x, $dst_y,$src_x,$src_y,$dst_w, $dst_h, $src_w, $src_h );
imagejpeg($dst_image, null, 100);

}[/code]

Works fine a page on its own, but when I added it to my function.php page and then tried to call t from another page I get this header message:

Warning: Cannot modify header information - headers already sent by (output started at .../city.php:11) in .../functions.php on line 106


As you can see my problem here is this line of the function:
[code] header('Content-type: image/jpeg');
[/code]
My header is:
[code]<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript" src="main_functions.js"></script>
</head>[/code]


I tried changing my header to
[code]<head>
<meta http-equiv="Content-Type" content="image/jpeg; charset=ISO-8859-1" />
<script type="text/javascript" src="main_functions.js"></script>
</head>[/code]

but it does not work. Like I said, I am not good at  headers, can someone help me!?
Link to comment
https://forums.phpfreaks.com/topic/34496-imposible-question/#findComment-162525
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.