Forum Moderators: coopster

Message Too Old, No Replies

zoom in function

         

xbl01234

8:59 am on Dec 31, 2008 (gmt 0)

10+ Year Member



Hi;
I'd like to ask some advice what kind of knowledge help me to write function for zoom in by php for photo, for instance,

<snip>

[edited by: dreamcatcher at 9:46 am (utc) on Dec. 31, 2008]
[edit reason] No personal urls, thanks. [/edit]

coopster

4:27 pm on Dec 31, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Perhaps you could download one of the open source image gallery applications and have a peek inside their functions to get an idea on some options.

denisl

5:40 pm on Dec 31, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



Don't know if this of use - I have a map that zooms using some snippets of code I picked up some years ago. It requires two maps. the initial one you click on, and a second larger map. In this case both images/maps are 325x266 pixels, the second map being 3 times the size of the first. With large maps, I have found servers to struggle and have needed to cut them into smaller maps.

The first map is in a form thus:

<FORM METHOD="POST" ACTION="map2.php">
<INPUT TYPE="IMAGE" SRC="../maps/map-a.png" ALIGN="right" NAME="mapa" alt="">
</FORM>

The map on the second page:

<img SRC="zoom.php?x=<? echo $mapa_x ?>&y=<? echo $mapa_y ?>" NAME="mapb" BORDER="0">

A separate file named zoom.php has the following code:

Header( "Content-type: image/png");
$bigmap=ImageCreateFromPng("../maps/map-b.png");
$image_out=ImageCreate(325,266);
$factor=3;
$posx=floor($x*$factor-162);
$posy=floor($y*$factor-133);
$copia=ImageCopyResized($image_out, $bigmap, 0, 0, $posx, $posy, 325, 266, 325, 266);
ImagePng($image_out);
ImageDestroy($bigmap);
ImageDestroy($image_out);

xbl01234

6:46 pm on Dec 31, 2008 (gmt 0)

10+ Year Member



Thanks Denisl, i will try your solution.