Osclass Support Forums

Osclass plugin support => Instant Messenger Plugin => Topic started by: ahmose on November 26, 2023, 05:29:56 PM

Title: S3 Cloud Image thumbnail support
Post by: ahmose on November 26, 2023, 05:29:56 PM
in im-create-thread page the ad thumbnail is not shown
i tracked it down to functions.php line 364 :
Code: [Select]
  if(isset($resource['s_name']) && $resource['s_name'] <> '') {
    $resource_url = osc_base_url() . $resource['s_path'] . $resource['pk_i_id'] . '_thumbnail.' . $resource['s_extension'];
  } else {
    $resource_url = osc_base_url() . 'oc-content/plugins/instant_messenger/img/no-image.png';
  }

but im not sure how to modify it so it supports s3 images, any help ?
Title: Re: S3 Cloud Image thumbnail support
Post by: ahmose on November 26, 2023, 06:09:34 PM
i replaced on line 365
Code: [Select]
osc_base_url() . $resource['s_path']with
Code: [Select]
osc_resource_path()
its working now but im not sure if this is the right way to do it.
Title: Re: S3 Cloud Image thumbnail support
Post by: MB Themes on November 27, 2023, 08:33:51 AM
I do not think so.
Try just using filter:

Code: [Select]
osc_apply_filter('resource_url', osc_base_url() . $resource['s_path'] . $resource['pk_i_id'] . '_thumbnail.' . $resource['s_extension']);
Title: Re: S3 Cloud Image thumbnail support
Post by: MB Themes on November 27, 2023, 08:36:47 AM
Actually it's not resource URL, but thumbnail URL so correct filter is resource_thumbnail_url

Code: [Select]
osc_apply_filter('resource_thumbnail_url', osc_base_url() . $resource['s_path'] . $resource['pk_i_id'] . '_thumbnail.' . $resource['s_extension']);
Title: Re: S3 Cloud Image thumbnail support
Post by: ahmose on November 29, 2023, 04:04:34 AM
no this is not working this is showing the domain url but not the s3 host url
Title: Re: S3 Cloud Image thumbnail support
Post by: MB Themes on November 30, 2023, 01:19:20 PM
All these should work (from S3 plugin):
Code: [Select]
osc_add_filter('resource_thumbnail_url', 'stc_update_img_url');
osc_add_filter('resource_preview_url', 'stc_update_img_url');
osc_add_filter('resource_original_url', 'stc_update_img_url');
osc_add_filter('resource_url', 'stc_update_img_url');

Or function stc_get_image_url itself.