Bug #67567 [Opn->Nab]: i cannot create the imagick() class and not access the functions.
| From: | requinix@php.net | Date: | Fri, 04 Jul 2014 10:13:21 +0000 |
| Subject: | Bug #67567 [Opn->Nab]: i cannot create the imagick() class and not access the functions. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186465@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67567&edit=1
ID: 67567
Updated by: requinix@php.net
Reported by: periyasamy at opendesigns dot in
Summary: i cannot create the imagick() class and not access
the functions.
-Status: Open
+Status: Not a bug
Type: Bug
-Package: *Web Server problem
+Package: *Graphics related
Operating System: windows 7 32-bit
PHP Version: 5.5Git-2014-07-04 (Git)
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Putting aside the fact that you give the wrong filename to imagick, which will throw an exception
when it can't find the file, you don't actually USE imagick to do anything. All the work
is done by GD.
Previous Comments:
------------------------------------------------------------------------
[2014-07-04 08:35:06] periyasamy at opendesigns dot in
Description:
------------
---
From manual page: http://www.php.net/imagick.setresolution
---
I want to set the resolution for a the image.
Test script:
---------------
<html>
<body>
<form action="image.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
<?php
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& in_array($extension, $allowedExts)) {
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] .
"<br>";
} else {
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . "
kB<br>";
echo "Temp file: " . $_FILES["file"]["tmp_name"] .
"<br>";
if (file_exists("images/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " already exists. ";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"],
"images/" . $_FILES["file"]["name"]);
$filename = "images/" . $_FILES["file"]["name"];
$image = $_FILES["file"]["name"];
$im = new Imagick($image);
$im->setResolution(144,144);
$im->readImage($image);
$percent = 0.5;
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$path = "images/upload/T".$image;
imagejpeg($thumb,$path);
imagedestroy($thumb);
//thumb
$target_width = $width * 1;
$target_height = $height * 1;
// Load
$thumb = imagecreatetruecolor($target_width, $target_height);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $target_width, $target_height, $width, $height);
$path = "images/thumb/U".$image;
imagejpeg($thumb,$path);
imagedestroy($thumb);
}
}
} else {
echo "Invalid file";
}
?>
Expected result:
----------------
I want to set the resolution for a particular image.
Actual result:
--------------
not set the resolution only resize the image
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67567&edit=1