[-_-] Posted February 11, 2008 Share Posted February 11, 2008 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. Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted February 11, 2008 Share Posted February 11, 2008 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'] . ... Quote Link to comment Share on other sites More sharing options...
[-_-] Posted February 11, 2008 Author Share Posted February 11, 2008 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. Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted February 11, 2008 Share Posted February 11, 2008 Yeah I mean there's no reason why you can't just store them in a thumbs folder. Quote Link to comment Share on other sites More sharing options...
[-_-] Posted February 11, 2008 Author Share Posted February 11, 2008 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 Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 11, 2008 Share Posted February 11, 2008 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 Quote Link to comment Share on other sites More sharing options...
[-_-] Posted February 11, 2008 Author Share Posted February 11, 2008 Ah I think I get it now. I've got to put the folder for the thumbs in this part of the script $thumburl = ''; $thumburl = '/thumbnails'; Sorry I'm only familiar with html and css. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.