Link to home
Start Free TrialLog in
Avatar of Luey
LueyFlag for United States of America

asked on

image magick will not upload any image larger than 100KB

Hello,  I have an upload image program that another programmer wrote a few years ago.  It uses image magick.  It has been working fine for a few years. All of the sudden it stopped uploading any images over about 100KB.  I do not have a clue what it could be.  Recently added SSL to this particular site.  But can try it at http and still cannot get it to upload any over 100KB.  Any help would be appreciated. Thanks

This is from the include
<?php 
 
    //function to upload image and check type
	
	 function upload_image($file_name) {
		   if (isset($_FILES[$file_name]))  {
		   //validate the type. Should be JPEG or PNG.
		   $allowed = array('image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png');
		   if (in_array($_FILES[$file_name]['type'], $allowed)) {
			   return $image_type = "ok";  }
		   else 
		     { return $image_type = "error";  }
	   }
	 }  
	 //end of upload image function
							
 
 
 
    //function to reduce and move image - receives path for permanent location
     
	 function move_image($file_name, $full_path, $short_path, $image_width)  {
		 // find ext
       $ext = end( explode('.', $_FILES[$file_name]['name']) );
	  
	   //get timestamp
	   $stamp = mktime();
		
	   //set the file location
	   $new_image = $full_path.md5($_FILES[$file_name]['name']) . $stamp .'.' .$ext;
	   $stored_name = $short_path.md5($_FILES[$file_name]['name']) . $stamp .'.' .$ext;
		 
	   $original_image =  $_FILES[$file_name]['tmp_name'];
	   
	   $size = GetImageSize($original_image);	  	
	   	   
	   //default max width is 300 unless specific width passed to function   
	   $max_width = "300";
	   $max_height = "300";
	   If ($image_width) {
		   $max_width = $image_width;
		   $max_height = $image_width;}
		   	   	       
	   exec("convert -size {$size[0]}x{$size[1]} $original_image -thumbnail $max_widthx$max_height $new_image");	       
	   
	   return $stored_name;	   }
   ?>

Open in new window

Avatar of Gary
Gary
Flag of Ireland image

If you cannot upload larger files then it's nothing to do with image magick

Check your .htaccess or php.ini file for these two settings

php_value upload_max_filesize
php_value post_max_size


...and check what they are set to

Also check if you have a max size set in the upload FORM.
Avatar of Luey

ASKER

Just ran phpinfo() and both are set to 10M
Avatar of Luey

ASKER

and nothing in htaccess about any of that.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Luey

ASKER

I am still working on your previous answers guys but I wanted you to know i get this in my error logs win it does not upload.

[Wed Oct 01 19:25:47 2014] [client 98.92.245.104] Failed loading /usr/php/54/usr/lib64/php/modules/ZendGuardLoader.so:  /usr/php/54/usr/lib64/php/modules/ZendGuardLoader.so: undefined symbol: zend_new_interned_string, referer: https://www.thecowboyshoponline.com/brand_submit.php
[Wed Oct 01 19:25:47 2014] [client 98.92.245.104] , referer: https://www.thecowboyshoponline.com/brand_submit.php
[Wed Oct 01 19:25:47 2014] [client 98.92.245.104] libgomp: Thread creation failed: Resource temporarily unavailable, referer: https://www.thecowboyshoponline.com/brand_submit.php
[Wed Oct 01 19:25:48 2014] [client 98.92.245.104] File does not exist: /home4/thecowbo/public_html/error_image.php, referer: https://www.thecowboyshoponline.com/brand_submit.php
I don't know much really about Zend (bar using Magento), but maybe something in Zend was updated that changed the default file size upload limit.
Avatar of Luey

ASKER

This is on a shared server and I do not use any of that.  I still say this problem is at the server because I have exact same code working on other sites with the same host.  I will keep digging. Thanks
Look at setting

MAGICK_THREAD_LIMIT=1