In my environment-specific config file, I set
c::set('url', 'http://salon-catherine.dev:3000');
On one page, I output a bunch of images like so:
<?php $n=0; foreach($carousel_images as $image): $n++; ?>
<div class="item<?php if($n==1) echo ' active' ?>">
<div class="image-wrapper">
<img src="<?php echo $image->resize(c::get('carousel_max_width'), c::get('carousel_max_height'))->url() ?>" alt="<?php echo html($image->title()) ?>" class="img-responsive" />
<?php if (!$image->caption()->empty()): ?>
<div class="carousel-caption">
<?php echo kirbytext($image->caption()) ?>
</div>
<?php endif; ?>
</div> <!-- .image-wrapper -->
</div>
<?php endforeach ?>
Which produces the following output. Notice how the middle item has the port number attached 2 times. The image is obviously not displayed:
<div class="item">
<div class="image-wrapper">
<img src="//salon-catherine.dev:3000/thumbs/4-umstyling1-3028dac80672c8bb3c2fcba3a1bc39fa.jpg" alt="" class="img-responsive" />
<div class="carousel-caption">
<p>unsere Arbeit</p>
</div>
</div><!-- .image-wrapper -->
</div>
<div class="item">
<div class="image-wrapper">
<img src="//salon-catherine.dev:3000:3000/thumbs/5-umstyling1-bc92b1f306404f68af70f5e37b37bbbd.jpg" alt="" class="img-responsive" />
<div class="carousel-caption">
<p>unsere Arbeit</p>
</div>
</div><!-- .image-wrapper -->
</div>
<div class="item">
<div class="image-wrapper">
<img src="//salon-catherine.dev:3000/thumbs/6-umstyling1-ded7d33a37e2b53d9076bb7789d677a6.jpg" alt="" class="img-responsive" />
<div class="carousel-caption">
<p>unsere Arbeit</p>
</div>
</div><!-- .image-wrapper -->
</div>
Here comes the weird part: When I remove the .carousel-caption
part from the PHP code, the problem no longer occurs:
<?php $n=0; foreach($carousel_images as $image): $n++; ?>
<div class="item<?php if($n==1) echo ' active' ?>">
<div class="image-wrapper">
<img src="<?php echo $image->resize(c::get('carousel_max_width'), c::get('carousel_max_height'))->url() ?>" alt="<?php echo html($image->title()) ?>" class="img-responsive" />
</div> <!-- .image-wrapper -->
</div>
<?php endforeach ?>
This works but is obviously not an option.
Another observation: If I call $image->url()
directly, omitting the resize()
part, the problem doesnβt occur either.