Jump to content

Thumbnails fun (CropImage)


Peter Knight
 Share

Recommended Posts

I have an image field as follows:

Max files allowed = 1

Formatted value = Automatic

Inputfield = cropimage

If I follow the instructions here, this needs to be my echo call 
 

<?php echo $page->photo_for_course->getThumb('crop-for-course-detail'); ?>

But this just outputs the fullpath as a string. The documentations states that "getThumb returns url to the thumbnail you have asked for". So I then thought I needed to tag an ->url on the end as follows

<?php echo $page->photo_for_course->getThumb('crop-for-course-detail')->url; ?>

It's not a first() issue as the file only allows for one image so Im a bit stuck.

I've achieved this before but was using the $pages API and had a foreach loop. Surely I don't need to foreach here as I'm only using a single image?

Thanks in advance. I feel like it's you guys that are building this site :-/

Link to comment
Share on other sites

Yep - You just bet me too it. I eventually tried creating a variable first and then passing the value to the echo thingy.

BTW, re. variables -  my wife came into the office yesterday and I must have looked particularly grumpy. The conversation went kind of like this:

Her: whats wrong?
Me: oh...just bloody variables

Her: Bloody fairy balls? I thought you were having ProcessWire problems!

Well, it made me laugh and got rid of my grump.

  • Like 4
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

×
×
  • Create New...