This might be helpful:
http://codex.ww.wp.xz.cn/Function_Reference/wp_get_attachment_image_src
I’m unsure if your services is an extension of post, but I see that you have an ID, You could use the ID and then specify the size of the image that gets displayed with the second parameter of wp_get_attachment_image_src.
Hope this helps!
If not, then I hope you find a solution soon!
thanks Mork, not sure how i can integrate wp_get_attachment_image into my code above. $services_photo is defined by the pod item field “main_photo”.
wordpress by default creates different sizes of all uploaded images and i wanted to take advantage of that. also have used smushit but don’t think this is working either.
l for now i’m just going to tell the client to upload smaller images.
Any images uploaded through Pods will be automatically resized by WordPress. So all you need to do is pass the file’s ID into wp_get_attachment_image_src and that should work well.
Or you can alternatively use our handy wrapper function and pass the file data, ID, or GUID into it:
http://pods.io/docs/code/field-functions/pods-image/
Thanks Scott, i will have to come back to this later in the week hopefully. Will update!
By the way, new pods site looks slick! Waiting for the storm of work I have on to die down a bit before I get thoroughly into it.
had a good chat with Phil Lewis.
First off I’ve corrected my syntax so it is up to date. The syntax I originally posted here is out of date (http://pods.io/2012/08/30/differences-between-pods1-and-pods2/).
In summary it now looks like this:
<?php
$services = pods('services');
$services->find('id ASC', -1);
$total_services = $services->getTotalRows();
?>
<?php if( $total_services>0 ) : ?>
<?php while ( $services->fetch() ) : ?>
<?php
$services_id = $services->field('id');
$services_name = $services->field('name');
$services_photo = $services->field('main_photo');
$services_slug = $services->field('permalink');
$services_photo = pods_image_url ( $services_photo, $size = 'medium', $default = 0, $force = false );
?>
Where “medium” could also be set to thumbnail, original, large…
Basically I have learnt a bit about php. I was trying to implement pods_image_url but i was trying to use it as a “method”, like so:
$album_photo = $album->pods_image_url ( $album_photo, $size = 'medium', $default = 0, $force = false );
Whereas I should have been using it as a “global function”:
$album_photo = pods_image_url ( $album_photo, $size = 'medium', $default = 0, $force = false );
Ah the endorphins running around my brain…
🙂