The question of how to create thumbnails with clickable links gets asked
on this newsgroup every so often - like clock work .
Just really posing this script here for google to archive it & so users
can be pointed to it in the future via a link to google groups .
<html>
<head>
<title>thumbnai ls.php</title>
</head>
<style type="text/css">
body {margin-bottom : 0px;margin-left : 0px; margin-right : 0px;
margin-top : 0px;}
A:link {text-decoration: none;}
A:visited {text-decoration: none;}
A:active {text-decoration: none;}
A:hover {text-decoration : underline;}
..backy{backgro und-color: #FFEEFF;}
..gap1{font-size: 1px;}
..gap2{font-size: 2px;}
..gap3{font-size: 3px;}
..gap4{font-size: 4px;}
..gap5{font-size: 5px;}
..gap6{font-size: 6px;}
..gap7{font-size: 7px;}
..gap8{font-size: 8px;}
..gap9{font-size: 9px;}
..tap
{
color : Black; background-color: #F9FBFB;
font-size : 20pt; font-family : Arial;
padding-left: 22px; padding-right: 22px; padding-top: 3px; padding-
bottom: 3px;
border: 1px solid #CFD1F1;
}
..box
{
background-color: #FFEFFF;
padding-left: 2px; padding-right: 2px; padding-top: 2px; padding-bottom:
2px;
border: 1px solid #FEDAFE;
}
..bar
{
background-color: #F5DDFF;
padding-left: 5px; padding-right: 5px; padding-top: 0px; padding-bottom:
3px;
border: 1px solid #DADBD1;
}
..thumbnav
{
color: #000000; background-color: #F4DEDE;
font-size: 10pt; font-family: Arial; text-align: center;
padding-left: 9px; padding-right: 9px; padding-top: 4px; padding-bottom:
4px;
}
..thumbnav:hove r
{
text-decoration: none;
color: #000000; background: #FFFFC0;
}
..mma{color : Maroon; font-size : 8pt;font-family : Arial;}
..mmb{color : Maroon; font-size : 10pt;font-family : Arial;}
..mmc{color : Maroon; font-size : 12pt;font-family : Arial;}
..mmd{color : Maroon; font-size : 14pt;font-family : Arial;}
..bba{color : Black; font-size : 8pt;font-family : Arial;}
..bbb{color : black; font-size : 10pt;font-family : Arial;}
..bbc{color : Black; font-size : 12pt;font-family : Arial;}
..bbd{color : Black; font-size : 14pt;font-family : Arial;}
..nna{color : Navy; font-size : 8pt;font-family : Arial;}
..nnb{color : Navy; font-size : 10pt;font-family : Arial;}
..nnc{color : Navy; font-size : 12pt;font-family : Arial;}
..nnd{color : Navy; font-size : 14pt;font-family : Arial;}
..rra{color : Red;font-size : 8pt;font-family : Arial;}
..rrb{color : Red;font-size : 10pt;font-family : Arial;}
..rrc{color : Red;font-size : 12pt;font-family : Arial;}
..rrd{color : Red;font-size : 14pt;font-family : Arial;}
</style>
<body class="backy">
<?php
$weed=basename( $_SERVER['PHP_SELF']);
$dir="test/images"; $columns=6;
$ext=".jpg";
# .jpg .gif .png , You can use any of these 3 image extensions , But not
more than one at a time .
$what=$_REQUEST['filex']; $what=strtolowe r($what);
if ($what<>"")
{
if ($what=="jpg") {$ext=".jpg";}
if ($what=="gif") {$ext=".gif";}
if ($what=="png") {$ext=".png";}
}
$thumbext="_thu mb" . "$ext";
$whatupper=str_ replace(".","", $ext); $whatupper=strt oupper($whatupp er);
?>
<div align="center" class="gap9">&n bsp;</div>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="tap">THU MBNAILS - <?php print $whatupper; ?></td>
</tr>
</table>
<div align="center" class="gap5">&n bsp;</div>
<table border="0" cellspacing="5" cellpadding="0" align="center">
<tr>
<td><a href="<?php print $weed; ?>?filex=jpg" class="thumbnav ">< JPG
></a></td>
<td><a href="<?php print $weed; ?>?filex=gif" class="thumbnav ">< GIF
></a></td>
<td><a href="<?php print $weed; ?>?filex=png" class="thumbnav ">< PNG
></a></td>
</tr>
</table>
<div align="center" class="gap5">&n bsp;</div>
<?php
$batman=0;
$joker=opendir( $dir);
while (false!==($boyw onder=readdir($ joker)))
{
$files[]=$boywonder;
$batman=$batman +1;
}
$temp=0;
while ($temp<$batman)
{
$demo=$files[$temp];
$riddler=strlen ($demo);
$penguin=substr ($demo,$riddler-4,4);
$catwoman=subst r($demo,$riddle r-10,10);
$img_name="$dir " . "/" . "$demo";
$thumb_name=str _replace($ext,$ thumbext,$img_n ame);
if ($penguin==$ext && $catwoman<>$thu mbext)
{
$pass=1;
$filename=$thum b_name;
if (!file_exists($ filename)) {$pass=0;}
if ($pass==0)
{
$max_width=150; $max_height=80;
$size=GetImageS ize($img_name);
$width_ratio=($ size[0] / $max_width); $height_ratio=( $size[1] /
$max_height);
if ($width_ratio>= $height_ratio) {$ratio=$width_ ratio;} else {$ratio=
$height_ratio;}
$new_width=($si ze[0] / $ratio); $new_height=($s ize[1] / $ratio);
if ($ext==".jpg") {$src_img=Image CreateFromJPEG( $img_name);}
if ($ext==".gif") {$src_img=Image CreateFromGIF($ img_name);}
if ($ext==".png") {$src_img=Image CreateFromPNG($ img_name);}
$thumb=ImageCre ateTrueColor($n ew_width,$new_h eight);
ImageCopyResamp led($thumb,$src _img,0,0,0,0,($ new_width-1),($new_height-
1),$size[0],$size[1]);
ImageJPEG($thum b,$thumb_name,1 00);
ImageDestroy($s rc_img);
ImageDestroy($t humb);
}
}
$temp=$temp+1;
}
$homer=0;
$joker=opendir( $dir);
while (false!==($boyw onder=readdir($ joker)))
{
$marge[]=$boywonder;
$homer=$homer+1 ;
}
$lisa=0;
$temp=0;
while ($temp<$homer)
{
$demo=$marge[$temp];
$riddler=strlen ($demo);
$penguin=substr ($demo,$riddler-4,4);
$catwoman=subst r($demo,$riddle r-10,10);
if ($catwoman==$th umbext)
{
$thumb_name="$d ir" . "/" . "$demo";
$img_name=str_r eplace($thumbex t,$ext,$thumb_n ame);
$millhouse[$lisa]=$thumb_name;
$diamondjoe[$lisa]=$img_name;
$lisa=$lisa+1;
}
$temp=$temp+1;
}
?>
<?php
print "<table border=0 cellspacing=1 cellpadding=0 align=center>";
$loopy=0;
while ($loopy<$lisa)
{
print "<tr valign=top>";
$tempxx=0;
while ($tempxx<$colum ns)
{
if ($loopy<$lisa)
{
$passimage=1;
$filename=$diam ondjoe[$loopy];
if (!file_exists($ filename)) {$passimage=0;}
if ($passimage==0)
{
print "<td class=box>";
print "$filename" ;
print "<br>";
print "<span class=rrb>FILE NOT FOUND</span>";
print "<br><br>";
print "<span class=mma>DELET E THE FOLLOWING FILE</span>";
print "<br>";
print "<span class=nnb>$mill house[$loopy]</span>";
print "<br>";
print "<span class=mma>TO PREVENT THIS ERROR FROM HAPPENING</span>";
print "</td>";
}
if ($passimage==1)
{
$moe=filesize($ diamondjoe[$loopy]);
$ralph=$moe;
$wiggum=strlen( $moe);
if ($ralph>999) {$ralph=substr( $ralph,0,$wiggu m-3);} else {$ralph="?";}
$barney="$ralph " . "k";
$apu=GetImageSi ze($diamondjoe[$loopy]);
$size=GetImageS ize($millhouse[$loopy]);
$duffbeer=$loop y+1;
print "<td class=box>";
print "<div align=left class=bar><span class=nna>($duf fbeer)</span>
<span class=bba>$apu[0] x $apu[1]</span<span class=mma>$barn ey</span>
</div>";
print "";
print "<div align=center class=gap3>&nbs p</div>";
print "<a href=$diamondjo e[$loopy]><img src=$millhouse[$loopy] width=
$size[0] height=$size[1] border=0></a><br>";
print "</td>";
}
}
$tempxx=$tempxx +1;
$loopy=$loopy+1 ;
}
print "</tr>";
}
print "</table>";
?>
</body>
</html> 2 2071
This must be the worst naming of variables and functions I've seen in a
long time. I would absolutely refuse to work with this code if I found
it in a commercial project. Lets hope nobody every points to this post,
shall we.
On Oct 30, 1:59 am, Krustov <m...@privacy.n etwrote:
The question of how to create thumbnails with clickable links gets asked
on this newsgroup every so often - like clock work .
Just really posing this script here for google to archive it & so users
can be pointed to it in the future via a link to google groups .
<html>
<head>
<title>thumbnai ls.php</title>
</head>
<style type="text/css">
body {margin-bottom : 0px;margin-left : 0px; margin-right : 0px;
margin-top : 0px;}
A:link {text-decoration: none;}
A:visited {text-decoration: none;}
A:active {text-decoration: none;}
A:hover {text-decoration : underline;}
.backy{backgrou nd-color: #FFEEFF;}
.gap1{font-size: 1px;}
.gap2{font-size: 2px;}
.gap3{font-size: 3px;}
.gap4{font-size: 4px;}
.gap5{font-size: 5px;}
.gap6{font-size: 6px;}
.gap7{font-size: 7px;}
.gap8{font-size: 8px;}
.gap9{font-size: 9px;}
.tap
{
color : Black; background-color: #F9FBFB;
font-size : 20pt; font-family : Arial;
padding-left: 22px; padding-right: 22px; padding-top: 3px; padding-
bottom: 3px;
border: 1px solid #CFD1F1;
}.box
{
background-color: #FFEFFF;
padding-left: 2px; padding-right: 2px; padding-top: 2px; padding-bottom:
2px;
border: 1px solid #FEDAFE;
}.bar
{
background-color: #F5DDFF;
padding-left: 5px; padding-right: 5px; padding-top: 0px; padding-bottom:
3px;
border: 1px solid #DADBD1;
}.thumbnav
{
color: #000000; background-color: #F4DEDE;
font-size: 10pt; font-family: Arial; text-align: center;
padding-left: 9px; padding-right: 9px; padding-top: 4px; padding-bottom:
4px;
}.thumbnav:hove r
{
text-decoration: none;
color: #000000; background: #FFFFC0;
}.mma{color : Maroon; font-size : 8pt;font-family : Arial;}
.mmb{color : Maroon; font-size : 10pt;font-family : Arial;}
.mmc{color : Maroon; font-size : 12pt;font-family : Arial;}
.mmd{color : Maroon; font-size : 14pt;font-family : Arial;}
.bba{color : Black; font-size : 8pt;font-family : Arial;}
.bbb{color : black; font-size : 10pt;font-family : Arial;}
.bbc{color : Black; font-size : 12pt;font-family : Arial;}
.bbd{color : Black; font-size : 14pt;font-family : Arial;}
.nna{color : Navy; font-size : 8pt;font-family : Arial;}
.nnb{color : Navy; font-size : 10pt;font-family : Arial;}
.nnc{color : Navy; font-size : 12pt;font-family : Arial;}
.nnd{color : Navy; font-size : 14pt;font-family : Arial;}
.rra{color : Red;font-size : 8pt;font-family : Arial;}
.rrb{color : Red;font-size : 10pt;font-family : Arial;}
.rrc{color : Red;font-size : 12pt;font-family : Arial;}
.rrd{color : Red;font-size : 14pt;font-family : Arial;}
</style>
<body class="backy">
<?php
$weed=basename( $_SERVER['PHP_SELF']);
$dir="test/images"; $columns=6;
$ext=".jpg";
# .jpg .gif .png , You can use any of these 3 image extensions , But not
more than one at a time .
$what=$_REQUEST['filex']; $what=strtolowe r($what);
if ($what<>"")
{
if ($what=="jpg") {$ext=".jpg";}
if ($what=="gif") {$ext=".gif";}
if ($what=="png") {$ext=".png";}
}$thumbext="_th umb" . "$ext";
$whatupper=str_ replace(".","", $ext); $whatupper=strt oupper($whatupp er);
?>
<div align="center" class="gap9">&n bsp;</div>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="tap">THU MBNAILS - <?php print $whatupper; ?></td>
</tr>
</table>
<div align="center" class="gap5">&n bsp;</div>
<table border="0" cellspacing="5" cellpadding="0" align="center">
<tr>
<td><a href="<?php print $weed; ?>?filex=jpg" class="thumbnav ">< JPG
></a></td>
<td><a href="<?php print $weed; ?>?filex=gif" class="thumbnav ">< GIF
></a></td>
<td><a href="<?php print $weed; ?>?filex=png" class="thumbnav ">< PNG
></a></td>
</tr>
</table>
<div align="center" class="gap5">&n bsp;</div>
<?php
$batman=0;
$joker=opendir( $dir);
while (false!==($boyw onder=readdir($ joker)))
{
$files[]=$boywonder;
$batman=$batman +1;
}$temp=0;
while ($temp<$batman)
{
$demo=$files[$temp];
$riddler=strlen ($demo);
$penguin=substr ($demo,$riddler-4,4);
$catwoman=subst r($demo,$riddle r-10,10);
$img_name="$dir " . "/" . "$demo";
$thumb_name=str _replace($ext,$ thumbext,$img_n ame);
if ($penguin==$ext && $catwoman<>$thu mbext)
{
$pass=1;
$filename=$thum b_name;
if (!file_exists($ filename)) {$pass=0;}
if ($pass==0)
{
$max_width=150; $max_height=80;
$size=GetImageS ize($img_name);
$width_ratio=($ size[0] / $max_width); $height_ratio=( $size[1] /
$max_height);
if ($width_ratio>= $height_ratio) {$ratio=$width_ ratio;} else {$ratio=
$height_ratio;}
$new_width=($si ze[0] / $ratio); $new_height=($s ize[1] / $ratio);
if ($ext==".jpg") {$src_img=Image CreateFromJPEG( $img_name);}
if ($ext==".gif") {$src_img=Image CreateFromGIF($ img_name);}
if ($ext==".png") {$src_img=Image CreateFromPNG($ img_name);}
$thumb=ImageCre ateTrueColor($n ew_width,$new_h eight);
ImageCopyResamp led($thumb,$src _img,0,0,0,0,($ new_width-1),($new_height-
1),$size[0],$size[1]);
ImageJPEG($thum b,$thumb_name,1 00);
ImageDestroy($s rc_img);
ImageDestroy($t humb);
}
}$temp=$temp+1;
}$homer=0;
$joker=opendir( $dir);
while (false!==($boyw onder=readdir($ joker)))
{
$marge[]=$boywonder;
$homer=$homer+1 ;
}$lisa=0;
$temp=0;
while ($temp<$homer)
{
$demo=$marge[$temp];
$riddler=strlen ($demo);
$penguin=substr ($demo,$riddler-4,4);
$catwoman=subst r($demo,$riddle r-10,10);
if ($catwoman==$th umbext)
{
$thumb_name="$d ir" . "/" . "$demo";
$img_name=str_r eplace($thumbex t,$ext,$thumb_n ame);
$millhouse[$lisa]=$thumb_name;
$diamondjoe[$lisa]=$img_name;
$lisa=$lisa+1;
}$temp=$temp+1;
}?>
<?php
print "<table border=0 cellspacing=1 cellpadding=0 align=center>";
$loopy=0;
while ($loopy<$lisa)
{
print "<tr valign=top>";
$tempxx=0;
while ($tempxx<$colum ns)
{
if ($loopy<$lisa)
{
$passimage=1;
$filename=$diam ondjoe[$loopy];
if (!file_exists($ filename)) {$passimage=0;}
if ($passimage==0)
{
print "<td class=box>";
print "$filename" ;
print "<br>";
print "<span class=rrb>FILE NOT FOUND</span>";
print "<br><br>";
print "<span class=mma>DELET E THE FOLLOWING FILE</span>";
print "<br>";
print "<span class=nnb>$mill house[$loopy]</span>";
print "<br>";
print "<span class=mma>TO PREVENT THIS ERROR FROM HAPPENING</span>";
print "</td>";
}if ($passimage==1)
{
$moe=filesize($ diamondjoe[$loopy]);
$ralph=$moe;
$wiggum=strlen( $moe);
if ($ralph>999) {$ralph=substr( $ralph,0,$wiggu m-3);} else {$ralph="?";}
$barney="$ralph " . "k";
$apu=GetImageSi ze($diamondjoe[$loopy]);
$size=GetImageS ize($millhouse[$loopy]);
$duffbeer=$loop y+1;
print "<td class=box>";
print "<div align=left class=bar><span class=nna>($duf fbeer)</span>
<span class=bba>$apu[0] x $apu[1]</span<span class=mma>$barn ey</span>
</div>";
print "";
print "<div align=center class=gap3>&nbs p</div>";
print "<a href=$diamondjo e[$loopy]><img src=$millhouse[$loopy] width=
$size[0] height=$size[1] border=0></a><br>";
print "</td>";
}
}$tempxx=$tempx x+1;
$loopy=$loopy+1 ;
}print "</tr>";
}print "</table>";
?>
</body>
</html>
<comp.lang.ph p>
<ha************ *@gmail.com>
<30 Oct 2006 06:58:33 -0800>
<11************ **********@m7g2 000cwm.googlegr oups.com>
This must be the worst naming of variables and functions I've seen in a
long time. I would absolutely refuse to work with this code if I found
it in a commercial project. Lets hope nobody every points to this post,
shall we.
Tickled yer fancy did it :-)
-- www.phpchatroom.co.uk This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rednelle |
last post by:
Greetings all,
As a newbie, using Access 2000, I would appreciate advice on the best
way to include pictures.
I have developed a 'Home Inventory' database which can include jpeg
thumbnails of my items and I can review things at anytime - on the desktop
where I created all this - no problem so far.
I networked the mdb file (only) across to my laptop and found the
pictures don't show. So I guess my database table is only storing links to
|
by: Showjumper |
last post by:
I have seen the article on 4 guys that descibes creating an event calandar.
However what i would like to do is have the days be clickable (i.e. click
the day and it show the details for that event) only if there is an event on
that day while other days are not clickable if there is no event. I have see
the post on scottonwriting about customizing the calendar to get ti to have
clickable days for .text. But i havent been able to modify this...
|
by: Rich |
last post by:
Hello,
I want to simulate the dynamic thumbnail display of Windows Explorer (winxp)
on a form or pannel container. If I place a picture box on my container
form/pannel and dimension it to the size of a thumbnail and set the sizemode
to Stretch -- I get one thumbnail. I want to retrieve all the picture files
(jpg, bmp) in a directory into an array list and then display this list as
thumbnails on my form dynamically. So my question is...
|
by: barb |
last post by:
So that the world at large benefits from our efforts, here is one fully
documented way to use Windows Irfanview freeware to create thumbnail web
galleries (http://www.irfanview.com).
STEP 1: Start with original thumbnails & two empty sub directories
STEP 2: Create smaller versions of the originals for one sub directory
STEP 3: Create thumbnail version of the originals the other sub directory
STEP 4: Create an index.html pointing to the...
|
by: divina11 |
last post by:
I'm wanting a html page with a series of thumbnails which are clickable to enlarge the image in a new window, how do you do this?
Currently I have the images in the following format.
<p>
An image
<img src="someImage.gif"
width="48" height="48">
in the text
</p>
| |
by: Jeff Gaines |
last post by:
I have spent the day learning how to use Zend Development Environment. I
can now produce a list of files in a directory, filtered by extension, and
apparently clickable. Unfortunately clicking on them in a browser doesn't
take me to the file link.
I have found examples for clickable URL's, FTP links and mailto addresses
but not files. I am managing to produce output like this:
<a...
|
by: breakupemail |
last post by:
Hello, on my website at http://www.breakupemail.com/ there is a horizontal navigation bar with 6 hyperlinks. Recently, I added a second navigation row below the first, with 2 links. Once this second navigation bar was added, the clickable area on the 6 links in the top row became greatly reduced when viewed in Firefox 2.0.0.9. It seems to work properly in IE 7.
Essentially, if you hold your mouse over the center of the text link, it will...
|
by: =?Utf-8?B?UGV0ZXIgSw==?= |
last post by:
I am working with Visual Studio or alternately with Expression Web. I need
to create about 50 aspx pages with about 1200 thumbnali images, typically
arranged in three to four groups per page, having hyperlinks to the
corresponding full size images.
Can anybody point me to locations in MSDN or elsewhere giving the references
to attach, the commands & objects for creating or opening the pages and
possibly available classes?
I have done...
|
by: momotaro |
last post by:
IMPORTANT: My first time with flash and actionscript but am a computer science student so code is ok.
that said I wanna build a xml based scrolling thumbnails in an horizontal bar.
each pic should have some effect when the mouse is over it +
the scrolling bar should scrol left or right depending on the mouse pos+
the bar stops when am over a pic (with some conditions)
I think this i all
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |