PHP - Moved: Have I Installed Imagemagick ?
This topic has been moved to Other Web Server Software.
http://www.phpfreaks.com/forums/index.php?topic=346533.0 Similar TutorialsThis topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=346325.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=350982.0 hi, I am trying to send an email with an attachment using PEAR, I have installed PEAR and in my email script I am including teh mail.php and mail_mime.php pages but now I get an error: Fatal error: Class 'Mail' not found in /home/fhlinux129/e/edisongray.com/user/htdocs/PEAR/Mail/mail.php on line 51 Line 51: Code: [Select] class Mail_mail extends Mail { This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 Hi all I need to re-write the below code so that it doesn't use the exec function: Code: [Select] $scale = '74x74'; $go = WEB_UPLOAD.'/test/images/'.$image; $stop = WEB_UPLOAD.'/test/images/'.$image_small; exec ("/usr/bin/convert $go -resize $scale\> -quality 100 $stop") or die("Error creating 74 x 74 image."); Many thanks for your help. Pete Hi all I am trying to resize an image using imagemagick but it won't let me use the below code as it shows a security error 'exec() has been disabled for security reasons': Code: [Select] $scale = '158x158'; $go = WEB_UPLOAD.'/test/images/'.$image; $stop = WEB_UPLOAD.'/test/images/'.$image_medium; exec("/usr/bin/convert $go -resize $scale\> -quality 100 $stop") or die("Error creating 158 x 158 image."); unset($scale, $go, $stop); How do I write the code that resizes the image without using the exec function? Many thanks for you help! Pete I have a line of code that has been working for over a year, then two days ago it failed in a few areas on my site and I hadnt made any changes. I contacted the host and there was no server updates etc. Its a php/imagemagick issue, basically the "widthxheight^ - Minimum values of width and height given, aspect ratio preserved" command does not work and fails to import the image at all when I add ^ to my code. I need it though and im getting fustrated, for now ive changed my code to: exec("convert $path1 -thumbnail 200x180 -colorspace rgb -gravity center -extent 170x150 $path2"); which works ok but is not spot on like it was before, what I really want is exec("convert $path1 -thumbnail 170x150^ -colorspace rgb -gravity center -extent 170x150 $path2"); What ever I do I cant get ^ to work anymore but oddly all other imagemagick commands are fine. Hi all I'm using MAMP and trying to install ImageMagick. Is there a way to test if it is correctly installed when using MAMP? ttmt Here is the code I have right now:
<?php header('Content-type: image/png'); $grey = new ImagickPixel('#ebebeb'); $orange = new ImagickPixel('#0f92d6'); $image = new Imagick('assets/lop.png'); $layer = new Imagick('assets/lop-base.png'); $layer->thumbnailImage(200, 0); $image->thumbnailImage(200, 0); $layer->paintOpaqueImage($grey, $orange, 100); // Place layer on image $image->compositeImage($layer, Imagick::COMPOSITE_SOFTLIGHT, 0, 0); // Let's merge all layers (it is not mandatory). $image->flattenImages(); echo $image; ?>It's putting the layers on top of eachother very nice. The thing is is that this involves some heavy shading at times depending on the bunny breeds. Here is what the base image ($image) looks like: And here is what the overlay ($layer) looks like: This is what the outcome looks like versus the intended result: I've tried almost all of their composite constants.. I can't figure out how to do this or the best way of going about it. Because the colors are going to be dynamic throughout the site so I can't just save a .png of every color combination.. and there will be more colors layered on top of eachother like markings/patterns/etc. Thanks for any help! Hi all I have created the below script to resize my images and it works fine for landscape images but if you select a portrait image it saves it as a landscape image. How do I modify the script so it keeps the same aspect ratio? Code: [Select] copy($_FILES['image1']['tmp_name'], WEB_UPLOAD."images/adverts/test/".$_FILES['image1']['name']) or die("Error uploading image."); $ext = strtolower(substr($_FILES['image1']['name'], strrpos($_FILES['image1']['name'], "."))); $rand = rand(1, 100000000000000); $name = $rand . $ext; $image_small = $rand . $ext; rename(WEB_UPLOAD."images/adverts/test/".$_FILES['image1']['name'], WEB_UPLOAD."images/adverts/test/".$name) or die("Error renaming image.");; $go = WEB_UPLOAD.'images/adverts/test/'.$name; $stop = WEB_UPLOAD.'images/adverts/test/'.$image_small; exec ("/usr/bin/convert $go -resize 10%\> -quality 100 $stop"); unset($scale, $go, $stop); Many thanks for your help. Pete Hi, Very new to PHP and am enjoying learning the ins and outs etc, but while creating my mam a website, ive ran into a problem while uploading, resizing and saving the file to my web host. Initially i used imagecreatefromjpeg, but this was taking too much memory up, so opted to use imagemagick. All of the features work apart from the file getting saved to the uploads directory on my web space. They always get saved to the root. If someone could help i would be very grateful. The code ive got currently is: <?php // If the form has been submitted do this if(isset($_POST['submit'])) { // Temporary upload image name $original_image = $_FILES['photo']['tmp_name']; // Get the image dimensions $size=GetImageSize( $original_image ); // Name to save the image as - in this case the same as the original $new_image = $_FILES['photo']['name']; // Maximum image width $max_width = "600"; // Maximum image height $max_height = "300"; // Resize the image and save exec("convert -size {$size[0]}x{$size[1]} $original_image -thumbnail $max_widthx$max_height $new_image"); echo "File uploaded<br>"; echo "<img src=\"".$new_image."\">"; } ?> Hopefully someone could help Many thanks, Matk. Need to change the letter spacing.. help? $tag = 'www.xxxxxx.com'; $text_draw->setFontSize(8); $text_draw->setFillColor("black"); $output_image->annotateImage($text_draw, 123, 34, 0, $tag); $text_draw->setFillColor("white"); $output_image->annotateImage($text_draw, 122, 33, 0, $tag); Hi I'm trying to resize pictures for thumbnails I can do this correctly at linux command line with the following command convert ideologies.jpeg -resize 300x200 ./Thumbnails/testphp.jpg However trying to wrap this in PHP doesn't seem to work // Upload file to server if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){ // Insert image file name into database $insert = $conn->query("INSERT into Threads (Title, ThreadBody, filename) VALUES ('$Title', '$BodyText', '$fileName')"); if($insert){ $statusMsg = "The file ".$fileName. " has been uploaded successfully."; exec("convert {['fileName']} -resize 300x200 wankertestphp.jpg"); } If you look above I do successfully hit the "The File has been uploaded successfully" line so it is entering that If statement. I've also checked the Threads table with a Select * from Threads and I can see the $fileName variable is entering there. I've tried numerous different ways around the $fileName variable (removing the brackets...removing the brackets and the apostrophes")
Any help is appreciated. (1) What does this actually do? (compress it?) $image = imagecreatefromjpeg("image.jpg"); header('Content-Type: image/jpeg'); imagejpeg($image); By using this rather than displaying by using www.site.com/image.jpg it reduces file size of an image from 2.5mb to 0.5mb !! (2) ImageMagick can't get these results. Am I doing something wrong? If I change the pixel size of an image in ImageMagick then I can reduce its file size, but (1) above reduces file size regardless of changing pixel size. I just installed XAMP on my windws pc. When I try to launch my index.html file, I only get this output: Hello World";?>
This is not correct...
<html>
What is wrong? Hello, I'm fairly new to PHP, and I'm trying to get the GD2 library working but I am having no luck. I have installed the library, and when I run phpinfo(); it shows that it is up and running, and all file types are supported. However, when I run the following code snippet nothing is displayed: <?php $im = @imagecreate (200, 100) or die ( "cannot create a new gd image."); $background_color = imagecolorallocate ($im, 240, 240, 240); $border_color = imagecolorallocate ($im, 50, 50, 50); $text_color = imagecolorallocate ($im, 233, 14, 91); imagerectangle($im,0,0,199,99,$border_color); imagestring ($im, 5, 10, 40, "a simple text string", $text_color ); header ("content-type: image/png"); imagepng ($im); ?> I have been struggling with this for a couple of weeks now with no luck. Any help would be greatly appreciated. How can i check whether php is installed or not on windows? I didn't installed wamp or xamp. But i have installed Zend Apache. And i can do http://localhost/ from browser. Hi, I'm working on a project which was going pretty well until I discovered the application doesn't actually know where it is installed. So far when I want to include the config file I just use $_SERVER['DOCUMENT_ROOT'].'/config.php';() Which works fine if the application is installed in the root directory. But how do I get the folder the application is installed in? e.g. Document Root Folder: C:\Web\ Actually Application Folder: C:\Web\MyApp\ How do I get the \MyApp dynamically? I can't just use './' all the time because I have files accessed by AJAX stored in other folders. Thanks in advance. How do I check in PHP if something like the GD library is installed on a server? I am going to be making a thumbnailing system and the user can install the app on their server. If they have the GD library, continue with making thumbnails, else show a default thumbnail. |