Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Image URL / are replaced with spaces!

images php coding issues or problems here.

Moderators: macek, egami, gesf

Image URL / are replaced with spaces!

Postby Hanscraft » Thu Jul 12, 2012 9:11 am

I've built my website so that the captions will show and word-wrap the width of the image by using the display:table property. However, this is not supported in IE7. I'm trying to use the pre-existing template used by my predecessor to force the images to work. Here's their original code:

Code: Select all
<div class="content clear-block">
       <div class="single_image_right">
            <div class="thumb t<?php print $node->field_single_img_align[0]['value']; ?>">
                <div class="thumbinner" style="width: <?php print ($imgsz + 2); ?>px;">
                    <a class="image" title="<?php print $img_alt; ?>" href="<?php print $clink; ?>">
                    <img class="thumbimage" width="<?php print $imgsz; ?>" src="<?php print $node->field_single_img_link[0]['value']; ?>" alt="<?php print $img_alt; ?>"/>
                    </a>
                    <div class="thumbcaption">
                    <?php print $node->field_single_img_caption[0]['value']; ?>
                    </div>
                </div>
            </div>
          </div>
   </div>


Now I've gone in and replaced it with some values to get this:

Code: Select all
<div class="content clear-block">
       <div class="single_image_right">
            <div class="thumb t<?php print $item['view'] ?>">
                <div class="thumbinner" style="width: <?php print ($item['view']+ 2); ?>px;">
                   
                    <img class="thumbimage" src="<?php print $item['view']; ?>" />
                    <div class="thumbcaption">
                   <?php if ($item['data']['title']): ?>
                    <?php print $item['data']['title']; ?>
               <?php endif; ?>
                    </div>
                </div>
            </div>
          </div>
   </div>


which won't print the image (nor can I get the image width).

The default Drupal template I'm working with is what gave me the fields to work into the original code:
Code: Select all
<?php if (!$field_empty) : ?>
<div class="field field-type-<?php print $field_type_css ?> field-<?php print $field_name_css ?>">
  <?php if ($label_display == 'above') : ?>
    <div class="field-label"><?php print t($label) ?>:&nbsp;</div>
  <?php endif;?>
  <div class="field-items">
 
    <?php $count = 1;
    foreach ($items as $delta => $item) :
      if (!$item['empty']) : ?>
        <div class="field-item <?php print ($count % 2 ? 'odd' : 'even') ?>">
          <?php if ($label_display == 'inline') { ?>
            <div class="field-label-inline<?php print($delta ? '' : '-first')?>">
              <?php print t($label) ?>:&nbsp;</div>
          <?php } ?>
         
         
         <div class="imagecache_image">
       <?php print $item['view'] ?>
         
          <div class="image-caption">
        <?php if ($item['data']['title']): ?>
              <?php print $item['data']['title']; ?>
         <?php endif; ?>
          </div>
           
            </div>
      

        </div>
      <?php $count++;
      endif;
    endforeach;?>
  </div>
</div>
<?php endif; ?>


Any ideas of how to get the image to print? This is what Chrome's Inspector shows me when I click on the blank space where the image should be has spaces where the forward slashes should be!
Hanscraft
New php-forum User
New php-forum User
 
Posts: 4
Joined: Mon Jan 02, 2012 1:13 pm

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.