473,385 Members | 1,192 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,385 software developers and data experts.

Need help with thumbnail creation - pulling an all-nighter

I'm having trouble with the functions for resizing a picture uploaded to my
server. Consider the following:

$jpeg = imagecreatefromjpeg($filePath); //I know this works!

$oldX = imageSX($jpeg);
$oldY = imageSY($jpeg);
$thumbH = 100;
$thumbW = ($oldX / $oldY) * 100; //I know the dimensions are correct

$thumbnail = ImageCreateTrueColor($thumbW, $thumbH);
if(!ImageCopyResampled($thumbnail, $jpeg, 0, 0, 0, 0, $thumbW, $thumbH,
$oldX, $oldY)) {
print 'Error message<br />';
return;
}
//No error is produced, so the system thinks the image copy worked.

imagejpeg($thumbnail, 'thumb.jpg');

I get an thumbnail image that is completely black. I did not get an error
from the copy, so the system thinks it works - but nothing was copied.

Can someone please give some help?

Jul 17 '05 #1
0 1382

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

Similar topics

3
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same...
8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
7
by: Chris Perry | last post by:
How do you create a thumbnail constrained to a box, without distorting and but making where it doesn't fill the box transparent. I'm two thirds there : Size fitImageSize =...
1
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this...
16
by: Mark | last post by:
Hello. I am attempting to use AppendChunk() to write binary data to a memo field in Access 2000. My initial call to AppendChunk() results in a data type conversion error. Any suggestions? Here...
4
by: Lunchtimemama | last post by:
I have a UI with a gallery of thumbnail image previews. The PictureBoxes are created and their Images are generated by a method which quickly retrieves the icon for the filetype. Worker threads...
1
by: Dooboise | last post by:
Hi. For my website, I'm trying to develop a JavaScript that makes a div appear. I have found several samples that toggle a div back and forth between visible and hidden, but what I need is a bit...
6
by: MGM | last post by:
Alright, so here's my issue. I have a bunch of .dbf files, about 40 or so by summer's end, I'd say. These dbf files somewhat differ from each other as far as number of columns and data is...
1
by: dodgeyb | last post by:
Hi there, Trying to allow client to upload image, thumbnail it, and save it into sql table image field. Code compiles & runs but image cannot be retrieved. any clues what I'm doing wrong pls ! ...
3
by: iswar | last post by:
Hi..friends Im new to asp.net.. im trying to create thumbnails from the images stored in database (sql server2000). and i want to view the image larger on click thumbnail as a pop-up.. please help...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.