Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create alternative to clarkson_object::get_thumbnail() that returns url for different sizes #168

Open
NielsdeBlaauw opened this issue Aug 21, 2019 · 1 comment

Comments

@NielsdeBlaauw
Copy link
Member

Maybe check out how ACF returns image formats for inspiration.

@jmslbam
Copy link
Contributor

jmslbam commented Aug 21, 2019

👍
What do think of an Image class?

clarkson_object->get_post_thumbnail() or something else new, could return and Image object. This Image class has methods of getting different information of this image.

So you could do object.get_post_thumbnail.get_src('large'); in your Twig templates.

$image = $object.get_post_thumbnail(); 
$image->get_src('full');

Here's the ACF code that handles the return of a Image field with a return format array https://github.com/wp-premium/advanced-custom-fields-pro/blob/ce74fdd9725db17435ceb627e340627131423724/includes/api/api-helpers.php#L3100
Or like Timber: https://github.com/timber/timber/blob/master/lib/Image.php#L439

The Image class could even extend from an Attachment class because they have a lot in common?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants