Jump to content

Outputting the first image within a query


Jon E
 Share

Recommended Posts

Hi,

Could someone give me a helping hand please?

I have the below code:

<?php 
// Show the gallery widget if there are slideshow images attached to this press article
if(count($page->slideshow_images)) {
	echo '<div id="article_slideshow_widget">';
	$n = 0;
	echo "$page->images->first()->url;<img src='http://i.imgur.com/0heduk5.png' class='article_slideshow_widget_zoom'></div>";
	$n++;
	}
	echo "";
?>

I want to output the first image from the images field in the article_slideshow_widget div, but it is only giving me the filename currently (I removed the img tags to see what was being output as I was being given a broken image as the complete URL isn't there!)

Sure I'm close but would really be grateful for a pointer.

Thanks so much

Jon

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...