Is there any way to manage the display of the "Ad Image" field?

If I go to /admin/structure/types/manage/simpleads/display I see no fields to manage its displays.

What I need is to set the display of the "Ad Image" field to a image style called "adaptative image" which is generated by the adaptative module to make images responsive.

If there is no way to do this then how can I make the image responsive?

Comments

chefnelone’s picture

Issue summary: View changes

more info

minnur’s picture

Copy "simpleads_img_element.tpl.php" template file to your theme folder and try to make changes there. Also see simpleads.api.php file, there is a hook "hook_simpleads_alter" that allows to alter the data which you can use in you theme or preprocess function for the template.

chefnelone’s picture

Thanks minnur.

I create a simpleads_img_element.tpl.php template file with the following code and it works brilliantly fine with the Adaptative image module.

Any chance you include a way to setup the image style in next versions?

<div class="simplead-container image-ad <?php if (isset($css_attributes)): print $css_attributes; endif; ?>">
<?php dpm($image_attributes);?>
  <?php 
  $image_attributes['style_name'] = 'adaptative_image_style';
  print l(theme('image', $image_attributes), $ad['url'], $link_attributes); ?>
</div>

minnur’s picture

Status: Active » Fixed

@chefnelone Thanks. I will add this to wish list and implement this feature as soon as possible.

Thanks.

volker23’s picture

I had the same issue and tried your workaround. But now images doesn't show up at all... i guess it's about the dpm(), i have no devel installed.

Is there any other way to add a class to the image. (I'm not a coder, but can work with a snippet...)

Thanks in advance...

Status: Fixed » Closed (fixed)

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

xalexas’s picture

You have to write name of your style. This is overridden code for simpleads_img_element.tpl.php :

<div class="simplead-container image-ad <?php if (isset($css_attributes)): print $css_attributes; endif; ?>">
  <?php
  $image_attributes['style_name'] = 'adaptive';//write here desired style name
  ?>

  <?php if (!empty($ad['destination_url'])) : ?>
    <?php print l(theme('image', $image_attributes), $ad['url'], $link_attributes); ?>
  <?php else : ?>
    <?php print theme('image', $image_attributes); ?>
  <?php endif; ?>
</div>

Copy that file to your theme's "templates" folder.

xalexas’s picture

Issue summary: View changes

more

Tran’s picture

Issue summary: View changes

Can anyone spell this out a little more clearly for me?