Upload thumb and image
Is there a way using Digital File Pro, to upload the image and then automatically create a small (thumbnail) of the image and put that in another directory?
many thanks
Vanrooj
Is there a way using Digital File Pro, to upload the image and then automatically create a small (thumbnail) of the image and put that in another directory?
many thanks
Vanrooj
Or maybe I'm missing the process - would it be to upload a single image and then create a thumbnail from that using PHP (on-the-fly?) so you would not need an image thumb library as the thumbnail would be created automatically?
many thanks
vanrooj
Your description seems correct. Currently you could use php and the GD library to automatically create the thumb on the fly. This feature will be added to the next version of DFP so that writing code manually won't be necessary.
Ray ~ that addition sounds like a good idea. It seems really unsettling to create a method that trusts someone to upload both image and relevant thumbnail (not to mention creating thousands of thumbs at the start of the database when the client has to sit for hours on end entering details into a new storefront). There is of course, the option to insert two image fields on the _detail.php that would allow users to check that both thumb and image are the same, but if at some point a minor amend or touch-up is done in photoshop 1) it may not be possible to see the difference 2) the two images would now be named differently image_thumb.jpg and image_01.jpg (if the auto increment option was set in the upload wizard and you of course forgot to upload the thumb).
I have GD library on my server.. so this code would be inserted on the results page, as a function of some kind? ie. function (create_thumb) and then to call the image I would echo (create_thumb) ~ does that sound about right to you?
You do not know a good source for this free php script?
many thanks
vanrooj
OK so I've looked around the web and found this code (from the php net resource site)
<?php
// The file
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
?>
Now - if I save the above code in a file called "thumb.php" then upload a large file named 'test.jpg' and then set the source of my image to "www.example.com/thumb.php" FANTASTIC! it works. It saves the large file as a small thumbnail.
HOWEVER!
How do I incorporate it into the Webassist recordset and repeat region so that images pulled from a database are set into their relevant rows; AND keep their ID so that when a user clicks on the thumb, it opens up the larger file?
I was hoping it would be as simple as
function thumbnail(the above code)
and then <?php echo thumbnail($row_WADAschool['pic']); ?>
But it isn't! I've tried a few variations, but I've reached a real block on this problem and can't see the answer.
Any help would be much received!
Many thanks
vanrooj
Hi there - no worries I've got it. It is a php script 'Thumbnail Image Generator' that you link to via the image source:
img src=http://www.example.com/thumbnailscript.php/?src=<?php echo ($row_WADAschool['pic']); ?>&x=200&y=100&q=50&f=0
The figures at the end relate to max size and compression setting
The <a href= link is the directory + Recordset so you can use it with lightbox to pop-out the larger file and you can still filter the recordset using the ID number ~ WHERE userID = userID etc (so that only the images associated to a specific user will show)
Happy Days!
vanrooj
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.