close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Upload thumb and image

Thread begun 3/27/2009 5:51 am by vanroojdotcom | Last modified 3/30/2009 11:08 am by vanroojdotcom | 3681 views | 5 replies |

vanroojdotcom

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

Sign in to reply to this post

vanroojdotcom

Revision:

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

Sign in to reply to this post

Ray BorduinWebAssist

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.

Sign in to reply to this post
Did this help? Tips are appreciated...

vanroojdotcom

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

Sign in to reply to this post

vanroojdotcom

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

Sign in to reply to this post

vanroojdotcom

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

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...