1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto Image Rotate for iPhone and iPad [Deleted]

Discussion in 'Code Modifications' started by AndyB, Apr 24, 2013.

  1. AndyB

    AndyB Well-Known Member

    AndyB submitted a new resource:

    Auto Image Orientation for iPhone and iPad - Uploaded images from iPhone and iPad will auto orient

    Read more about this resource...
     
    Digital Doctor likes this.
  2. eransss

    eransss Active Member

    where can i find ImageMagick?
     
  3. AndyB

    AndyB Well-Known Member

    Ask your web hosting provider to install it on your server. Then enable it in the Admin CP.

    Admin CP -> Home -> Options -> Attachments -> Default Image Processor -> ImageMagick PECL Extension
     
  4. cclaerhout

    cclaerhout Well-Known Member

    May be you should add in the addon presentation that the exec command is probably disabled on most of share hosting plans.
     
    HWS likes this.
  5. eransss

    eransss Active Member

    i have no way of getting them to install it for me :(
     
  6. eransss

    eransss Active Member

    isnt their anyway for me to be able to do it or be able to bypass it?
     
  7. Rambro

    Rambro Well-Known Member

    Also, some better detailed instructions on what to do with that code. Since its all inside the box, some people might not know where or what to copy/paste.
     
    ibaker likes this.
  8. OakleyForum

    OakleyForum Active Member

    Can this be used if you are using GD but have ImageMagick installed on the server?
     
  9. AndyB

    AndyB Well-Known Member

    Yes.
     
  10. eransss

    eransss Active Member

    I contacted my web host which is ipage and they said they will not install it is their another way so i can use this add-on?
     
  11. AndyB

    AndyB Well-Known Member

    Sorry Imagemagick is required.
     
  12. Marcus

    Marcus Well-Known Member

    Is this implemented in 1.2?
     
  13. Rambro

    Rambro Well-Known Member

    Good question
     
  14. Rudy

    Rudy Well-Known Member

    This hack probably needs modification to work in XF 1.2, as the line number now puts it in the middle of an existing function. (I can probably guess where it might go.)
     
  15. Rudy

    Rudy Well-Known Member

    OK, just eyeballing things here, this is where the hack must go in XF 1.2, inserting it around line 204.

    Code:
            $imageInfo = @getimagesize($this->_tempFile);
            if (!$imageInfo)
            {
                if (in_array($this->_extension, array('gif', 'jpg', 'jpe', 'jpeg', 'png')))
                {
                    $this->_errors['extension'] = new XenForo_Phrase('the_uploaded_file_was_not_an_image_as_expected');
                }
                return;
            }
    
    // START HACK
    exec("/usr/bin/mogrify -auto-orient $this->_tempFile");
    // END HACK
    
            $imageInfo['width'] = $imageInfo[0];
            $imageInfo['height'] = $imageInfo[1];
            $imageInfo['type'] = $imageInfo[2];
    
    Untested!
     
  16. AndyB

    AndyB Well-Known Member

    For Xenforo version 1.2.

    File: library/Xenforo/Upload.php

    At line #195

    Code:
    
    		$imageInfo = @getimagesize($this->_tempFile);
    		if (!$imageInfo)
    		{
    			if (in_array($this->_extension, array('gif', 'jpg', 'jpe', 'jpeg', 'png')))
    			{
    				$this->_errors['extension'] = new XenForo_Phrase('the_uploaded_file_was_not_an_image_as_expected');
    			}
    			return;
    		}
    		
    		// start hack	
    		
    		exec("/usr/bin/mogrify -auto-orient $this->_tempFile");
    		
    		// end hack
    
    
     
    DeltaHF, Marcus and Rudy like this.
  17. Rudy

    Rudy Well-Known Member

    Provided this works on my server, what I might do is write that line as "@exec("/usr/bin.....etc. " so it kills any error message if it fails.
     
    HWS likes this.
  18. Rambro

    Rambro Well-Known Member

    Let us know how it turns out. This is a major annoyance that I'd like to get fixed.
     
  19. Rambro

    Rambro Well-Known Member

    Well, apparently, this isn't working.
     
  20. tommydamic68

    tommydamic68 Well-Known Member

    @AndyB This worked for awhile, what could make it not work suddenly?
     

Share This Page