I have a case content-type that has an image_field. I have configured the field to use a default image in cases when no image is upload for a case. I then try to render the image using the following code:

<?php $view = node_view($node); ?>
<div class="search-result-case">
    <div class="search-info"><?php print t('Publicerad'); ?>: <?php print date('d - M - Y', $node->created); ?></div>
    <div class="search-snippet">
    <?php print render($view['field_image']); ?>

If the case has a connected image then the field is rendered as expected, but in other cases nothing in displayed. When I check under recent log messages I see this:

Location   http://localhost/test/sites/default/files/styles/case_170x107/public/default_images/default_case_pic_0.png?itok=CWr6R4Rs
Referrer   http://localhost/test/search/node/case
Message    Unable to generate the derived image located at public://styles/case_170x107/public/default_images/default_case_pic_0.png.

I don't understand why it fails to generate a style for my default image when it works fine with user supplied images.

I have checked the permission on the folder and everything seems fine, so I really don't understand why this is not working?

Notice that all other images that is uploaded gets their image styles generated without any problem. The error only gets triggered in case of a default image connected to the field_image field.

  • @ShawnConn - This isn't a duplicate. All my images gets their styles generated without any problem, except for the default image connected to the file_image field in the content-type. – Cyclonecode May 20 '15 at 17:50
  • I don't understand why people just click close without even reading the question? This is not a duplicate – Cyclonecode May 23 '15 at 5:20
  • I've deleted my flag comment. Hopefully, that prevents it from being re-flagged for deletion. You might want to rewrite some of the question, the "Unable..." part has a bit of a red herring effect. – Shawn Conn May 23 '15 at 18:18
  • Where's your default image located relative to doc root? – sanzante May 30 '15 at 11:06
  • @tunic - It's uploaded through the field ui and stored in public://default_images/<image.jpg> – Cyclonecode May 31 '15 at 1:36

For what it's worth and consideration. Make sure your php.ini is configured correctly and that your. upload_max_filesize and max_file_uploads settings are adequate. My numbers are arbitrary, but I've had similar issues that require this general adjustment.

Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 200M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 200
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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