I am unable to generate the media styles on my production server while it is working fine on my local machine.

Production server is having centos and httpd web server while my local have apache2.2 and ubuntu.

I have invested more than a day to apply many changes given on the forums like below:

  • Cheking with $conf['image_allow_insecure_derivatives'] = False;
  • By changing multiple options in .htaccess
  • httpd settings for Allow from all and others
  • By changing ownership of files and its subdirectory to apache user
  • Full permission on files and all inner directories
  • Using imageinfo_cache module : I used this module and its started working for few images but randomly so uninstalled the same

Note: I noticed that if a new image style is created then its sample file works well and stored in the files's style directory but when we apply the same style on any image field and upload the image it doesn't create the image in the style directory. I checked that main image is uploaded in the files directory but its file permission get changed to 664 and it doesn't get created in the style directory at the time of style creation. If I change the permissions manually and then reload the page it shows the styles created. Means images permissions are getting changed on upload.

Tried many solutions to maintain the same directory permissions on the image too but that is not applied by any condition. If I check in the console it gives 403 (forbidden). Looking for any help..................Thanks

CommentFileSizeAuthor
#2 image_style_generation.patch634 bytessunilsinghgaur
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sunilsinghgaur created an issue. See original summary.

sunilsinghgaur’s picture

FileSize
634 bytes

So after digging many days, I found one solution. I just added the following lines in the modules/image.module in line number 1056 and now it started creating the images and working fine for all styles.

// Create derivated image if it doesn't exist.
  if (!file_exists($file_url) && !file_exists($uri)) {
    if (file_exists($path)) {
      $current_style = image_style_load($style_name);
      image_style_create_derivative($current_style, $path, $uri);
    }
  }

Created patch for the same. Attaching patch also.

To resolve this, I already tried the following things:

  1. drush image-flush: Did not help
  2. Changed permissions of styles to 777: Did not help
  3. Changed ownership of styles to apache : Did not help
  4. Cleared all caches several times: Did not help
  5. Disabled and re-enabled clean URLs: On disable clean URLs, images are getting created in the styles and working, but when clean URL is enabled, then the same issue (Access Denied) comes every time and didn't create the image styles.
  6. Created another instance and tested: Issue persists
  7. Created new custom styles to check the issue: Did not help
  8. Changed +FollowSymLinks to +SymLinksIfOwnerMatch in .htaccess: Did not help.
  9. Commented Options None and Options +FollowSymLinks in .htaccess: Did not help
  10. Changed Apache webserver to Nginx : Did not help
  11. Installed imageinfo_cache module : Did not help
  12. Added $conf['image_allow_insecure_derivatives'] = False; : Did not help
sunilsinghgaur’s picture

Status: Active » Fixed
Issue tags: +argument with clean url
B Boy Breaker’s picture

Oh my god.
I can't believe i spent 3 hours and after all that time i checked the drupal issues ...
#2 works fine
thank you man you saved the rest of this hard day ...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.