I am doing some work for a motorcycle shop that wants to display clickable thumbnails on their gallery page. I've set up a dir - category relationship and they can create directories on the fly and upload pics to that category.
The scrip then searches the main gallery dir lists all the Directories in it as categories then iterates through the dirs to collect all jpg files and displays a thumbnail image for clicking.
This is easy to do with the "width' and 'height' attributes of the '<img' tag. It is extremely slow though as the directories grow in size.
I have created this bit of code in the main gallery script
and the code in 'thumbs.php:
no errors, the page executes nicely and quick but I am not rendering any images on the page. I can inject this code in between the '<a href=blah>' & '<./a>' without the header and I get the jpeg code displayed as a link. The code is finding the file obiviously, but I ainlt gettin' no image.
Anyone with an idea why?
It is not on a Frihost server. The server has the right version of GD on it. I checked it with this line in my code
vardump(gd_info());
Output:
Anyone gotta clue?
The scrip then searches the main gallery dir lists all the Directories in it as categories then iterates through the dirs to collect all jpg files and displays a thumbnail image for clicking.
This is easy to do with the "width' and 'height' attributes of the '<img' tag. It is extremely slow though as the directories grow in size.
I have created this bit of code in the main gallery script
| Code: |
| print("<td><a href=\"$base_image\"><img src=\"thumbs.php?image=$base_image\" alt=\"Powder Coat $print_cat\" /></a></td>\n"); |
and the code in 'thumbs.php:
| Code: |
|
<?php $base_image = $_GET['image']; list($width, $height) = getimagesize("$base_image"); $multiplier = 100/$width; $new_width = $width * $multiplier; $new_height = $height * $multiplier; $thumb = imagecreatetruecolor($new_width, $new_height); $source = imagecreatefromjpeg("$base_image"); imagecopyresized($thumb, $source, 0,0,0,0, $new_width, $new_height, $width, $height); header('Content-type: image/jpeg'); imagejpeg($thumb); imagedestroy($thumb); ?> |
no errors, the page executes nicely and quick but I am not rendering any images on the page. I can inject this code in between the '<a href=blah>' & '<./a>' without the header and I get the jpeg code displayed as a link. The code is finding the file obiviously, but I ainlt gettin' no image.
Anyone with an idea why?
It is not on a Frihost server. The server has the right version of GD on it. I checked it with this line in my code
vardump(gd_info());
Output:
| Quote: |
|
array(11) { ["GD Version"]=> string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(false) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XBM Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) } |
Anyone gotta clue?
