close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Upload thumb and image

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

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

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