Jump to content


Photo

Click on image to enlarge


  • Please log in to reply
16 replies to this topic

#1 felguard

felguard

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 29 May 2005 - 01:32 AM

Hi, can some1 help me find out how to do this? Like in sites they have a small thumbnail picture, and when you click on it, the full image is shown in a pop up window. And by doing this, is it possible that you only need one image? Like you dont make a small thumbnail and link it to the full image, is there a way by making it click to enlarge with just one image?

Heres an example: http://www.naruto-ku...wallpapers.html

Please help! Thanks.

#2 Stu

Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 29 May 2005 - 01:48 AM

yes.

just resize the image to the size you need the thumbnail to be, and link it to the image itself to open in a new broswer window (easy way). or use javascript to have a popup with the image in it like they have in your example.

search google for javascript popup and you'll be able to find some code and more info.

#3 adam123

adam123

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 2,306 posts
  • Location:London, UK
  • Interests:Programming and stuff.

Posted 29 May 2005 - 02:39 AM

I'm sure I wrote a PHP script that does this automatically, I'll go look for it.
Does your host support PHP?

#4 felguard

felguard

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 29 May 2005 - 05:02 AM

really??? thanks, and yes my host does support PHP.

#5 felguard

felguard

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 29 May 2005 - 06:56 PM

theres a php script one? koo, i thought it would of been a javascript, but whichever way works would be fine. :)

#6 adam123

adam123

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 2,306 posts
  • Location:London, UK
  • Interests:Programming and stuff.

Posted 30 May 2005 - 02:18 AM

I'm not on my own computer so I can't get it now.
Also, Don't double post.

#7 venomsnake

venomsnake

    Jedi In Training

  • Members
  • PipPip
  • 481 posts
  • Gender:Male

Posted 07 June 2005 - 09:29 PM

<A HREF="directory/image.tag" TARGET="_blank"><img src="directory/image.tag" width="***" heigh="***"></A>

hope that helps :D use the same image

#8 _*Speed_*

_*Speed_*
  • Guests

Posted 07 June 2005 - 10:00 PM

Hmm i found this code.
<script LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=80
0,height=600,left = 240,top = 212');");
}
</script>

and to open it by link you do this,
<A HREF="javascript:popUp('http://www.yourwebsite.com/yourpicture.jpg')">Open Picture</A>


#9 ludwigw

ludwigw

    P2L Jedi

  • Members
  • PipPipPip
  • 823 posts
  • Gender:Male
  • Interests:Designer at Lee ter Wal.

Posted 07 June 2005 - 10:25 PM

Using the same image would mean you;d have to load the larger image first :D Maybe create a "mask" of the image with PHP which I think adam123 has done

#10 _*Speed_*

_*Speed_*
  • Guests

Posted 11 June 2005 - 10:14 PM

What??? No its not loading the main image on the page load. It loads the thumbnail. And once you click the bigger image comes.

#11 felguard

felguard

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 11 June 2005 - 11:00 PM

Hmm i found this code.

<script LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=80
0,height=600,left = 240,top = 212');");
}
</script>

and to open it by link you do this,
<A HREF="javascript:popUp('http://www.yourwebsite.com/yourpicture.jpg')">Open Picture</A>

um, i tried putting this on, but then it messes up the entire page. i add it in the head area rite?

#12 _*Speed_*

_*Speed_*
  • Guests

Posted 11 June 2005 - 11:20 PM

Oh sorry i didnt state that, you put the first code in the head, and you put the link anywhere on the page.

#13 felguard

felguard

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 12 June 2005 - 12:47 AM

yea, i put the above code between <head> and </head> and the 2nd code where i want my image, but wen i do that, my page gets all messed up. thanks anyway.

#14 Stu

Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 22 June 2005 - 07:48 AM

I'm sure I wrote a PHP script that does this automatically, I'll go look for it.
Does your host support PHP?


adam did you have any luck finding that script? happens that im looking for the same thing now but too lazy to do it myself with 20 or 30 thumbnails.

also, what was that local server you posted before, i cant find it in search.

#15 adam123

adam123

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 2,306 posts
  • Location:London, UK
  • Interests:Programming and stuff.

Posted 22 June 2005 - 01:58 PM

<?php

$image = $_GET['image'];

if (!$max_width)
  $max_width = 490;
if (!$max_height)
  $max_height = 368;

$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];

$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;

if ( ($width <= $max_width) && ($height <= $max_height) )
{
  $tn_width = $width;
  $tn_height = $height;
}
else if (($x_ratio * $height) < $max_height)
{
  $tn_height = ceil($x_ratio * $height);
  $tn_width = $max_width;
}
else
{
  $tn_width = ceil($y_ratio * $width);
  $tn_height = $max_height;
}

$src = ImageCreateFromJpeg($image);
$dst = ImageCreateTrueColor($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);

?>

I've got it set so it takes the address of the image in the url, but i'm sure you could edit it so it takes the value of a database and the like.
You can adjust max_width and height variables to your needs.

Oh yeah, you need GD2Lib installed as a PHP extenstion.

=================

PHPTriad is the server package I mentioned.

#16 Stu

Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 22 June 2005 - 11:58 PM

cheers mate, your a diamond. :blink:

#17 felguard

felguard

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 23 June 2005 - 12:25 AM

woot! thx adam123, ive been waiting for this. :blink:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users