|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11020 GD not working on digitalcamera jpg's
Submitted: 2001-05-22 12:04 UTC Modified: 2001-05-22 18:40 UTC
From: dat8hywb at stud dot hitos dot no Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.5 OS: Win 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
4 + 33 = ?
Subscribe to this entry?

 [2001-05-22 12:04 UTC] dat8hywb at stud dot hitos dot no
Look at the bugs for GetImageSize. I guess it's the same JPG problem with GD functions.

This function works perfect with most jpg's but when uploading pictures from digital cameras it does nothing. 

function resize($bildet, $forholdstall) {
	$size = GetImageSize("$bildet");
	$width = $size[0];
	$height = $size[1];
	echo "Skalerer...";
	//regner ut forholdstall
	if ($width > $height) # resize ny bildest?rrelse 
		$utregnettall = ($width / $forholdstall);
		$width = $forholdstall;
		$height = (int)($height / $utregnettall);
		$utregnettall = ($height / $forholdstall);
		$height = $forholdstall;
		$width = (int)($width / $utregnettall);
	if (strpos("$bildet", ".jpg") || strpos("$bildet", ".jpeg")) {
		$status = true;
		$img_in = ImageCreateFromJPEG("$bildet");

		// den resiza fila skal v?re s? mye mindre:
		$img_out = ImageCreate($width, $height);
		ImageCopyResized($img_out, $img_in,0,0,0,0, $width, $height, $size[0], $size[1]);
		ImageJPEG($img_out, "$bildet");
	else {
		$status = false;
	$retur = array(
		"error" => $status,
		"height" => $height,
		"width" => $width
	return $retur;
}# function resize


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-22 18:40 UTC]
The getimagesize() is fixed in CVS.


PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 03:01:30 2024 UTC