activities_helper.php
1 year ago
agent_helper.php
1 year ago
auth_helper.php
9 months ago
blocks_helper.php
1 year ago
booking_helper.php
1 year ago
bricks_helper.php
1 year ago
bundles_helper.php
1 year ago
calendar_helper.php
9 months ago
carts_helper.php
1 year ago
connector_helper.php
9 months ago
csv_helper.php
9 months ago
customer_helper.php
9 months ago
customer_import_helper.php
9 months ago
database_helper.php
9 months ago
debug_helper.php
1 year ago
defaults_helper.php
1 year ago
elementor_helper.php
1 year ago
email_helper.php
9 months ago
encrypt_helper.php
1 year ago
events_helper.php
9 months ago
form_helper.php
9 months ago
icalendar_helper.php
1 year ago
image_helper.php
1 year ago
invoices_helper.php
9 months ago
license_helper.php
1 year ago
location_helper.php
1 year ago
marketing_systems_helper.php
1 year ago
meeting_systems_helper.php
1 year ago
menu_helper.php
9 months ago
meta_helper.php
1 year ago
migrations_helper.php
1 year ago
money_helper.php
1 year ago
notifications_helper.php
9 months ago
order_intent_helper.php
9 months ago
orders_helper.php
1 year ago
otp_helper.php
9 months ago
pages_helper.php
1 year ago
params_helper.php
1 year ago
payments_helper.php
1 year ago
price_breakdown_helper.php
1 year ago
process_jobs_helper.php
1 year ago
processes_helper.php
1 year ago
replacer_helper.php
1 year ago
resource_helper.php
1 year ago
roles_helper.php
9 months ago
router_helper.php
1 year ago
service_helper.php
1 year ago
sessions_helper.php
1 year ago
settings_helper.php
9 months ago
short_links_systems_helper.php
9 months ago
shortcodes_helper.php
9 months ago
sms_helper.php
1 year ago
steps_helper.php
9 months ago
stripe_connect_helper.php
9 months ago
styles_helper.php
9 months ago
support_topics_helper.php
1 year ago
time_helper.php
9 months ago
timeline_helper.php
9 months ago
transaction_helper.php
1 year ago
transaction_intent_helper.php
1 year ago
util_helper.php
9 months ago
version_specific_updates_helper.php
9 months ago
whatsapp_helper.php
1 year ago
work_periods_helper.php
1 year ago
wp_datetime.php
1 year ago
wp_user_helper.php
1 year ago
image_helper.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | class OsImageHelper { |
| 4 | |
| 5 | public static function get_image_url_by_id($attachment_id, $size = 'thumbnail', $placeholder = false){ |
| 6 | $image = $attachment_id ? wp_get_attachment_image_src($attachment_id, $size) : false; |
| 7 | if($image){ |
| 8 | $url = $image[0]; |
| 9 | }else{ |
| 10 | if($placeholder){ |
| 11 | $url = $placeholder; |
| 12 | }else{ |
| 13 | $url = LATEPOINT_IMAGES_URL . 'default-avatar.jpg'; |
| 14 | } |
| 15 | } |
| 16 | return $url; |
| 17 | } |
| 18 | |
| 19 | |
| 20 | public static function get_agent_avatar($agent_id){ |
| 21 | if($agent_id && has_post_thumbnail($agent_id)){ |
| 22 | return self::get_image_url_by_id(get_post_thumbnail_id($agent_id), 'thumbnail', LATEPOINT_IMAGES_URL . 'default-avatar.jpg'); |
| 23 | }else{ |
| 24 | return LATEPOINT_IMAGES_URL . 'default-avatar.jpg'; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | |
| 29 | public static function get_customer_avatar($customer_id){ |
| 30 | if($customer_id && has_post_thumbnail($customer_id)){ |
| 31 | return self::get_image_url_by_id(get_post_thumbnail_id($customer_id), 'thumbnail', LATEPOINT_IMAGES_URL . 'default-avatar.jpg'); |
| 32 | }else{ |
| 33 | return LATEPOINT_IMAGES_URL . 'default-avatar.jpg'; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | } |