Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 10 Sep 2014, 17:04
devoidfeast devoidfeast is offline
 
Join Date: Jun 2014
Find First Image or Attachment and replace it with Avatar

Hello Fellows,
I am trying to customize the "Search Widget" where i am replacing the user avatar with a thumbnail.the thumbnail is to be generated from any video or images attached to the post.i am able to write an api call which gets the thumbnail from any video attached but i am still not successful to do it for images and attachment.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

getVideoThumbnail(url) is method i found in the "core/vb/api/content/video.php". i was successfully able to get the thumbnail from and video embeded.


Now i want to do some thing like the video with photos or [IMG] tag i found a method in the
"core/vb/api/content/text.php"

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

this function can reads all the post and search for images in it and populate the following array

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


How can i call the above api function from a template?

Thank You.
Reply With Quote
  #2  
Old 10 Sep 2014, 17:55
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The nodeid variable would depend on what variable is in scope for the template you're using.
Reply With Quote
  #3  
Old 10 Sep 2014, 18:10
devoidfeast devoidfeast is offline
 
Join Date: Jun 2014
i will call it in "display_contenttype_searchwidget_item_header" template.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 10 Sep 2014 at 18:29 ---------------

thumbnail variable will contain an array?? because autoPopulatePreviewImage() populate an array "data" which contain a possible address to the preview image.after calling the function as follow.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now i just get on the avatar the name of the user with image missing.

am i using the thumnail variable wrong?

Last edited by devoidfeast; 10 Sep 2014 at 18:31.
Reply With Quote
  #4  
Old 10 Sep 2014, 19:34
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Sorry, don't have access to the vbulletin source code right now.

Does autoPopulatePreviewImage actually return the array? Or does it use it internally?

If you want to see what's in the variable, you can use:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 10 Sep 2014 at 22:52 ---------------

$data isn't returned from the function, so you can't use it to do what you want it to do.
Reply With Quote
  #5  
Old 10 Sep 2014, 22:53
devoidfeast devoidfeast is offline
 
Join Date: Jun 2014
the "autoPopulatePreviewImage()" in the api calls to "autoPopulatePreviewImage()" of library

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

the "autoPopulatePreviewImage()" in the Library does not return anything it also destroys all the variables the only array left ath the end is the following but its not returned.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


if let say at the end i add a line return $data how will i be able to access "$data['previewimage'] " from template page.

thank you
Reply With Quote
  #6  
Old 10 Sep 2014, 23:22
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
{vb:raw thumbnail.previewimage}
Reply With Quote
  #7  
Old 10 Sep 2014, 23:43
devoidfeast devoidfeast is offline
 
Join Date: Jun 2014
great Work. Mr Eddie.
Thank you
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 23:03.

Layout Options | Width: Wide Color: