-
Generating thumbnails in PHP
Hello
I have a site where users have the option of uploading pictures when they make an entry. So I have a bunch of pictures in a sub-directory on the server.
Whenever someone looks at an entry, the script will generate a link that can be clicked, and that shows the picture in a separate pop-up window.
What I would like to do is to modify the script so that it will display a small thumbnail of the original picture on each entry.
Can you help me creating a php function that takes a picture from the server and displays a small thumbnail ?
Thanks in advance.
-
-
There are two options here:
Display the image smaller, so that it is preloaded when you view the large image.
Or use php to render the image at a smaller size.
For the first, it's just an issue of math. Just change the width to a certain percent, etc.
For resizing with php:
http://www.php.net/manual/en/functio...yresampled.php
Example 2 should be helpful.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
Use the GD library to resize the image. You will have to have the code on a seperate document and call this page just like you would an image.
<img src="image.php">
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks