473,385 Members | 1,464 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.

image resampling

That function:

function
resizeImage($defsize,$newsize,$dX,$dY,$bgcolor,$ne wname,$fileformat,$fQuality)
{
$firstimage = imagecreate($defsize[0],$defsize[1]);
imagecolorallocate($firstimage, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
$newimage = imagecreatetruecolor($defsize[0],$defsize[1]);
imagecopy ($newimage,$firstimage,0,0,0,0,$defsize[0],$defsize[1]);
$image = imagecreatefromstring ($GLOBALS['filestr']);
//$image = imagecreatefromjpeg($newname);

imagecopyresampled($newimage,$image,$dX,$dY,0,0,$n ewsize[0],$newsize[1],$image,
$GLOBALS['tmpsize'][1]);
if ($fileformat == "png") {
imagepng ($newimage, $newname);
$newtype = "image/x-png";
} else {
imagejpeg ($newimage, $newname, $fQuality);
$newtype = "image/pjpeg";
}
imagedestroy ($newimage);
return $newtype;
}

give me bad results, quality is very bad

- how to improve that-
- why $image = imagecreatefromstring ($GLOBALS['filestr']); is that
the best way ?
Jul 17 '05 #1
1 1492
probably the reason can be here - imagecopy()
try to change it to imagecopyresampled() because imagecopyresampled()
do the same thing but smoothly

Jul 17 '05 #2

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

Similar topics

0
by: Andrew Crowe | last post by:
Hi guys, We've got a content management system in PHP that allows users to upload images that are resized and sharpened. The resizing is done using the GD libraries resampling function and to...
2
by: Faree | last post by:
Hi, I am a PHP Developer.can any one help me on image upload and display of that image.what i want is uploading an image to a directory ,displaying of that image as a thumbnail.when i...
5
by: Frecklefoot | last post by:
I'm using DrawImage() to copy one image onto another, larger one. I'm using a DrawImage() overload to stretch the source image onto the destination. The problem is that when it draws the stretched...
3
by: Harley | last post by:
is there any way to manipulate images in vb.net in asp.net? i have a 280x280pixel jpg file, and want to display it in 2 sizes, 280x280 and 70x70... without having to create 2 files... (actually...
2
by: Bob Bedford | last post by:
I've an image that is 300x225 pixels. I've to send this image to mobile phones using the mms. For this the best result is given using 120x160 pixels. So I may generate a 120 pixels large image,...
7
by: bcutting | last post by:
I am looking for a way to take a large number of images and find matches among them. These images may not be exact replicas. Images may have been resized, cropped, faded, color corrected, etc. ...
6
by: evolozik | last post by:
hi everyone i need some help please i am using PHP5 and i used a tutorial and when i copied the code for Resampling an image proportionally, it worked perfectly but when i added it in my page it...
8
by: berkshire | last post by:
Hi, Anyone know of a script out there that can resize images and not sacrifice image quality? I've been using phpthumb (http://phpthumb.sourceforge.net/) but when compared to an image resized...
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.