Jump to content

simple image viewer with thumbnails


[-_-]

Recommended Posts

Could anyone tell me how to set a seperate directory for the thumbnails for this script, They get way too pixelated. I want to use this script so users of my site can view video game screenshots? 

 

http://www.codewalkers.com/c/a/Site-Navigation-Code/Simply-image-viewer-script/

 

//======================
// START set thumbnails on or off

//comment this section out if you don't want thumbs to show at all

$showThumbs = 5;//number of thums to show
$thumbsList = '';
$thumburl = '';
if ($_GET['thumb'] == 'yes'){
//read thumb param to url if exists
$thumburl = '&thumb=yes';

for ($i=0;$i<$showThumbs;$i++){
if ($thispic + $i + 1 < $numPics){
$currThumb = $thispic + $i + 1;
$thumbsList .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $currThumb . $thumburl . '" title="' . $pics[$currThumb] . '"><img src="' . $pics[$currThumb] . '" alt="' . $pics[$currThumb] . '" height="100" width="100" border="0" /></a>   ';
}
}
$onOff ='<a class="thumbs" href="' . $_SERVER['PHP_SELF'] . '?id=' . $thispic . '">Turn Thumbnails Off</a>';
} else {
$onOff ='<a class="thumbs" href="' . $_SERVER['PHP_SELF'] . '?id=' . $thispic . '&thumb=yes">Turn Thumbnails On</a>';
}

// END set thumbnails on or off 

 

Thanks.  :-*

Link to comment
Share on other sites

Hard to tell what you are doing, but for whatever file you are dealing with $_SERVER['PHP_SELF'] is relative to the document root, so if I understand correctly href="../thumbs/' . $_SERVER['PHP_SELF'] . ...

So wherever I find $_SERVER['PHP_SELF']  I should add ../thumbs/ before it and store my resized pics in a folder named thumbs?

 

You can see what I'm trying to do here http://www.plentyoftorrents.com/imageviewer/imageviewer.php?id=0&thumb=yes

 

The thumbs would look alot better if I could resize them in photoshop rather than have the php resize them.

 

 

Link to comment
Share on other sites

I tried that but got this error, Parse error: Parse error: parse error, unexpected '.' in /html/imageviewer/imageviewer.php on line 76

then i got rid of the periods before the thumbnails folder and got this error.

parse error, unexpected '/' in /html/imageviewer/imageviewer.php on line 76

Link to comment
Share on other sites

I looked at the page you referenced. It doesn't look like you're displaying the thumbnails you might be creating.

 

The generated source says:

<a href="/imageviewer/imageviewer.php?id=4&thumb=yes" title="6.jpg"><img src="6.jpg" alt="6.jpg" height="100" width="100" border="0" />

 

If you want to output the thumbnail that is created, you need to do something like:

<a href="/imageviewer/imageviewer.php?id=4&thumb=yes" title="6.jpg"><img src="/imageviewer/imageviewer.php?id=4&thumb=yes" alt="6.jpg" height="100" width="100" border="0" />

 

As it is now, you are having HTML shrink large pictures sized 1,024px × 768px down to 100px x 100px which is why they look horrible (and it's slow).

 

Ken

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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