473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Suggestions for creating thumbs after upload

On image upload, I would like to save the image and also auto-create a
right-size image for faster browsing, and also a thumbnail for indexes, so
that slower connections do not have to wait for the larger image, and I can
store preferences for each user as to what sizes they prefer to wait for.

Are there PHP code/tools to do this? Would sure appreciate a pointer in the
right direction.

TIA.

~ Duane Phillips.
Nov 20 '06 #1
2 1476
phpThumb can do this:

http://phpthumb.sourceforge.net/

It can cache requests, so you could have the thumbnails be generated
automatically.

An article on creating thumbnails with gd:

http://icant.co.uk/articles/phpthumbnails/

Duane Phillips wrote:
On image upload, I would like to save the image and also auto-create a
right-size image for faster browsing, and also a thumbnail for indexes, so
that slower connections do not have to wait for the larger image, and I can
store preferences for each user as to what sizes they prefer to wait for.

Are there PHP code/tools to do this? Would sure appreciate a pointer in the
right direction.

TIA.

~ Duane Phillips.
Nov 20 '06 #2

"petersprc" <pe*******@gmail.comwrote in message
news:11*********************@j44g2000cwa.googlegro ups.com...
phpThumb can do this:

http://phpthumb.sourceforge.net/

It can cache requests, so you could have the thumbnails be generated
automatically.

An article on creating thumbnails with gd:

http://icant.co.uk/articles/phpthumbnails/

Duane Phillips wrote:
>On image upload, I would like to save the image and also auto-create a
right-size image for faster browsing, and also a thumbnail for indexes,
so
that slower connections do not have to wait for the larger image, and I
can
store preferences for each user as to what sizes they prefer to wait for.

Are there PHP code/tools to do this? Would sure appreciate a pointer in
the
right direction.

TIA.

~ Duane Phillips.
Here is a little function I put together after getting tips from this group:
function thumbnail($img, $w_d, $h_d) {
// $img is the image
// $w_d is the desired width in pixels
// $h_d is the desired height in pixels
//
// function to get the width and height to display q thumbnail
// Pass in the image location, the deisred width and the desired height
// Ouput is an array of height and width to display that can be
// exploded with the list command
list($w, $h, $type, $attr) = getimagesize($img);
$calc_width = $h_d * $w / $h;
$calc_height = $w_d * $h / $w;
if ($calc_width <= $w_d) {
$disp_width = $calc_width;
$disp_height = $h_d;
} else {
$disp_width = $w_d;
$disp_height = $calc_height;
}
return array($disp_width, $disp_height);
}

// Testing with a picture of coda, width of
list($disp_width, $disp_height) =
thumbnail("the_picture_location_and_name", the_max_height, the_max_width);
// The picture dimensions, $disp_width and $disp_height, are put in
with php brackets in the html declaration
Nov 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Phil Powell | last post by:
Where can I find an online PHP form validator script library to use? I have tried hacking the one here at work for weeks now and it's getting more and more impossible to customize, especially now...
1
by: Dean J. Garrett | last post by:
I've seen a couple of ASP sites that allow the upload of images and then automatically create a thumb-nail equivalent of the image. Normally, I've required users to upload 2 versions of the image...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
1
by: Jon Pope | last post by:
I've got a custom image file type whose contents I would like to have displayed when the user selects View|Thumbnails. I know I need to somehow add these files' images to the folder's THUMBS.DB,...
0
by: Pete Davis | last post by:
I've seen a number of posts by people asking for the file format for Thumbs.db files in Windows XP. This isn't so much an answer to a specific question as a post of how to read them. I've...
1
by: Rako | last post by:
My problem is: I want to create an index to any of the available picture-groups. This index is a table of thumbs with a scrollbar. If you click on the thumb, you get the full picture displayed. ...
1
by: amsablotny | last post by:
Hi all, I am a newbie at this. I am trying to create thumbnails. However, I am only creating black image with the correct thumbnail size. I am using php 5.1.6 and GD 2.0.28. Below is the...
2
by: djpaul | last post by:
Hello, I have this program and when i want to load pictures it crashes at the form.showdialog()....??? Here it goes: Private Sub CmbPath_SelectedIndexChanged(ByVal sender As Object, ByVal e As...
1
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.