Support » Fixing WordPress » Image Issues: Cropping

  • Resolved draigun

    (@draigun)



    Hello,

    I have installed WordPress manually on my own VPS, and I am having issues with images; particularly with cropping them via media.

    At first, I got the error that wp-content/uploads/ folder could not be created. This was easily solved by chmodding the correct permissions to the parent folder.

    What my issue is currently: attempting to crop an uploaded image via media (I am not using an plugins – this is a fresh install with a few minor tweaks to the settings), and it giving me an error that says: “There has been an error cropping your image.” I attached a link that gives you a few images of what I am talking about here.

    More than likely, this a problem with something in my VPS that is causing something to break, but I’m clueless as to find it. It can’t be low memory, as I have 128M allocated to my isolated kernel, and it certainly can’t be disk issues, as I have plenty of space. What I think it could be, is a possible permission fault, that is, the owner of my wp-content/uploads is not root (me), but rather “www-data” without the quotes. This is due to me uploading the image via in-browser feature on my WordPress site. I’ve researched a bit more on this part, but I’ve only seen that it causes weird FTP issues to occur in a PHP file; nothing related to permission denying or the such.

    So, that leaves me to ask WordPress support how to pinpoint the issue, and to fix it.

    Many thanks

    Images:
    Error 1 – http://www.djdraigun.com/img/error1.png
    Error 2 – http://www.djdraigun.com/img/error2.png

    Edit: Link code isn’t working, so I had to remove it with the address intact.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Those errors don’t say much, but it could easily be memory related.

    The RAM on the VPS doesn’t have any relation at all to how much memory is allocated to each PHP process by the Apache server. You should look at raising the memory alocated for this, and you should find that it helps.

    http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

    Alright, looked in both wp-settings.php and wp-config.php respectively, I cannot find anything relating to memory, other than a comment that pertains to initializing the constants at line 32 in wp-settings.php

    Perhaps I’m missing something here? I read the documentation, and it does tell me that the respective areas to edit are in the files, but yet, they cannot be found. Either those guides are outdated for WordPress 3.9.1, or I am misunderstanding something.

    Also, I’ll elaborate a bit more on what I meant by permission faults:
    When you crop an image, that image is then exported to the server in the form of “imagename-XxY.png” (in wp-content/uploads/year/month/) where X is the width, and Y is the height of the image. In that regard, the fact that image crop is failing could possibly be caused by permissions failing to grant access to make these files on the server. However, the problem with this theory, is that I even went to the extent of chmodding 777 (for debugging purposes of course) to the respective directory, and to no available, that didn’t help.

    if it’s permission issues you will see errors in your server logs. Look through them to see what you can find.

    As for the code, it’s not in the standard wp-config.php file, you need to add it to the file yourself. Having it in there would lead to way to many people playing around with it “just to test…” and breaking their servers. That’s why it’s left out by default.

    Added that line, first tried 64M, didn’t work, upgraded to 96M, still didn’t work. Going above that is just redundant, as there is no way cropping an image will need to use that much memory, no matter how you look at it.

    I checked my error log, and from what I can tell, there is no indication that there is anything leading towards permissions faults.

    There’s really not much more to go on then. If you can’t see error messages, then there’s no clues there. if the memory increase doesn’t help, then that might not be the case still.

    Just as a last resort, set up a file that display phpinfo(); so that you can see exactly what the memory available is. That might show you something that isn’t quite right.

    Apart from that, without some clues as to what’s going on, there’s really not much else to suggest. You can go through the core code and add your own de-bugging steps, and that might tell you something. That’s about all that I can think of at this point.

    I created the file before, so here it is: http://www.djdraigun.com/info.php

    I knew from the start that 128M is PHP’s limit, as is my total allocated RAM to the VPS.

    Also, I didn’t mean that there were not any errors in the errors log, just that none seem to point towards memory or permission faults.

    So, you have enouhg memory, an no errors that you can see…

    Now you’re basically stuck with doing some of the hard work yourself going through the code and de-bugging to find out where it stops and why. It won’t be easy, but when your setup doesn’t give you any clues as to why things are not working it’s impossible to diagnose any issues remotely like this.

    Alright, I’ll have to debug it, and I will post the solution if I ever find one here, so others hopefully won’t have to go through this process.

    Thank you for the help

    draigun

    (@draigun)

    I found the solution, although it didn’t take me 3 months to find it… I just gave up, and decided to pursue the issue once again.

    Apparently, it was a chmod ownership issue for the root directory of WordPress.

    Invoking this command via terminal (Note: wp is the subdirectory of the root directory of apache2):
    chown www-data: /var/www/html/wp -R

    Fixes the issue with uploading images and downloading/installing plugins via the Admin interface. These were all issues I’ve had before, and was unable to figure out why.

    Still, I am unable to crop images. So this only solves some of the problem.

    Given you’ve hopefully got the right permissions, I’d suggest that it’s probably not cropping because you’re missing the PHP GD extension (often called php5-gd).

    Greetings,

    My server was missing the PHP-GD installation. Once I installed via terminal, did a restart to the processes and to my amazement, that fixed the issue.

    Paired with the solution I found, the original issue I had in the beginning has been completely fixed.

    Many thanks!

    gingerdog & draigun: thanks a lot.

    i didn’t ever try the permissions-steps, but i installed the php5-gd, and the problem with cropping was solved.

    Hi,

    I’m also having trouble cropping images when I try to crop an image for the header. Unfortunately, I know nothing about coding and still relatively little about WordPress. I’m running 5.1.1 on Mac OS 10.9.5. Could someone give me exact instructions on how to include that line of code? I don’t know what the references to apache me 🙁

    I’m going to up this too.
    Dedicated server, administered by myself. Tried chmod 777 onto my folder : no success.
    I also already have php5-gd installed.

    I am trying to upload my header image but i keep getting a cropping error. The file is 1600×230 and i’ve tried various formats (jpeg, png). I don’t know how to proceed.

    I can post the header uncropped, but the image has text at the bottom, so i need it to show

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Image Issues: Cropping’ is closed to new replies.