0

I am using Drupal 7.32, and I enabled the Image module.

I have created a custom "Image Style" so that I could add Bootstrap 3 "img-responsive" class to my image in my view, but adding that custom style to the image field for my view causes Drupal to change the URL where the image is placed and then not resolve the image.

This is the "Image" styles user interface. Notice at the bottom I added my own custom style.

enter image description here

This is is my custom image style definition.

enter image description here

This is my Image field in my view. Here I set the Image style to my custom Image style that I created.

enter image description here

This is the view displaying the content for that view. It is not resolving the images because it is changing the title to http://localhost/system/files/styles/center_block_responsive_image/private/images_content/news/latin.america.night_.jpg?itok=1yvjqDtY. This would resolve but it is adding styles/center_block_responsive_image/private to the URL for the image, when the URL should be http://localhost/system/files/images_content/news/latin.america.night_.jpg?itok=1yvjqDtY.

enter image description here

The content type's image field saves the image to the private file system. Does anyone know why the Image module would rewrite the image like this? I have a default image that I am using for each piece of content.

The image resolves for the default content type, despite the fact that it is also adding styles/center_blow_responsive_image/private to the URL, as in http://localhost/system/files/styles/center_block_responsive_image/private/default_images/elaw.jpg?itok=BpkGqQJ-.

If I change the "Image Style" on the view field back to "none" it retrieves the image just fine.

Does anyone know why the Image module is adding this extra text to the URL which causes it to not resolve properly?

4
  • Have you had a look in the module's issue queue for patches?
    – Darvanen
    Commented Jan 21, 2015 at 0:53
  • 1
    The extra parts in the path are just how it works. The problem is why is there no image there.
    – rooby
    Commented Jan 21, 2015 at 2:22
  • 1
    As @rooby said, that is how the module works. The URL doesn't point to an existing imagine; the module creates the styled image when the URL is accessed. The problem is the module is not able to create the styled image, probably because it doesn't have the right access to the folder where the styled images are created.
    – avpaderno
    Commented Jan 21, 2015 at 4:58
  • To see the errors being generated, flush your image styles by updating your style or with drush image-flush, and then check your watchdog and error logs.
    – calebtr
    Commented Jan 21, 2015 at 5:19

1 Answer 1

0

I found a fix by adding

$conf['image_allow_insecure_derivatives'] = TRUE;

to my settings.php file

I found the solution from this drupal stack exchange posting: Drupal 7.20 Image Styles return a url with Access Denied

I'll hold off on accepting my answer here as the accepted answer for a bit in case someone informs me that I should not be solving the problem this way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.