4images Modifications / Modifikationen > Mods & Plugins (Releases & Support)

[MOD] Media sites v1.11.1 (2010-12-22)

(1/53) > >>

V@no:

----------------- [ Index ] -----------------
[*]Introduction
[*]Screenshots / Demo
[*]List of changed/new files
[*]Installation
[*]Tweaks
[*]Troubleshooting
[*]Version history
[/list]

----------------- [ Introduction ] -----------------

With this mod you'll be able add to your gallery videos (as remote images) from the following media sites:
youtube.com (since v1.9 playlist also supported)
metacafe.com
liveleak.com
stupidvideos.com (only url from <embed> can be used (or url with #NN at the end) and no autoplay)
video.yahoo.com
vids.myspace.com (only works with myspace player videos) (removed since v1.11)
break.com
spikedhumor.com
hulu.com (no autoplay)
myvideo.de (no autoplay) (added in v1.1)
rutube.ru (added in v1.2)
dailymotion.com (added in v1.3)
mtv.com (added in v1.3)
sevenload.com (added in v1.5)
izlesene.com (no autoplay) (added in v1.6)
mynet.com (added in v1.6)
onsmash.com (added in v1.6)
gametrailers.com (added in v1.6)
gamespot.com (added in v1.6)
smotri.com (added in v1.7)
collegehumor.com (added in v1.7)
googlewave.com (added in v1.8 ) (experimental, must have google wave account to view)
220.ro (added in v1.8)
trilulilu.ro (video links only!) (added in v1.8)
funnyordie.com (added in v1.8)
dailyhaha.com (no autoplay) (added in v1.8)
megavideo.com (no autoplay) (added in v1.8)
aniboom.com (added in v1.9)
vimeo.com (added in v1.9)
tm-tube.com (added in v1.9)
vevo.com (added in v1.10)
mp3upload.ca (added in v1.11)
zippyshare.com (audio only!) (added in v1.11)

Since version 1.4 new BBCode tag added: [media]media site url[/media] (check out Tweak 4 for more info)
Since version 1.5 can automatically fetch thumbnails from most media sites and save them locally on the server. For now this feature only works if media site submitted via members upload form, not ACP.
----------------- [ Screenshots / Demo ] -----------------


You can see the demo here


----------------- [ Changed files ] -----------------

includes/functions.php
download.php
member.php

----------------- [ New files ] -----------------

includes/media_sites.php
templates/<your template>/icons/*.gif (an icon for each site)
templates/<your template>/media/*.html (media template for each site)

----------------- [ Installation ] -----------------


Step 1

Download attached media_sites_vXX.zip and media_sites_templates_and_icons_vXX.zip packages. Unpack them and upload to your 4images root directory, restoring the following directory tree:

includes/media_sites.php

copy all files from template/default/icons/ folder to templates/<your template>/icons/ on your site

copy all files from template/default/media/ folder to templates/<your template>/media/ on your site

Step 2

Open includes/functions.php
Find:
function check_remote_media($remote_media_file) {

Insert below:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if (media_sites($remote_media_file))
    return 1;
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.1

Find:
function get_file_extension($file_name) {

Insert below:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if ($data = media_sites($file_name))
    return $data[0];
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.2

Find:
    $media = $site_template->parse_template("media/".$file_extension);

Insert above:
/*
  MOD MEDIA SITES
  START INSERT
*/
    media_sites_template_vars($media_src);
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.3

At the end, above closing ?> insert:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
include(ROOT_PATH."includes/media_sites.php");
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.4 (added in v1.2)

Find:
function get_basename($path) {

Insert below:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if ($data = media_sites($path))
    return $data[1]['media_file'];
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.5 (added in v1.2)

Find:
function get_basefile($path) {

Insert below:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if ($data = media_sites($path))
    return $data[1]['media_file'];
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.6 (optional, needed for bbcode in comments) (added in v1.4)

Find:
    $text = preg_replace($search_array, $replace_array, $text);

Insert above:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
    $text = media_sites_bbcode($text);
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 2.7 (optional, it disables download button, you can skip entire step 3 if you apply this) (added in 2009-06-20)

Find:
  if (!check_permission("auth_download", $image_row['cat_id'])) {

Replace with:
/*
  MOD MEDIA SITES
  BEGIN REPLACE
*/
  if (!check_permission("auth_download", $image_row['cat_id']) || media_sites($image_row['image_media_file'])) {
/*
  MOD MEDIA SITES
  END REPLACE
*/



Step 3

Open download.php
Find:
    while ($image_row = $site_db->fetch_array($result)) {

Insert below:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
      if (empty($image_row['image_download_url']) && $data = media_sites($image_row['image_media_file']))
        continue;
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 3.1

Find:
  $remote_url = 0;
  if (!empty($image_row['image_download_url'])) {


Replace with:
/*
  MOD MEDIA SITES
  BEGIN REPLACE
*/
  $remote_url = 0;
  if (empty($image_row['image_download_url']) && $data = media_sites($image_row['image_media_file'], 1))
  {
    $file['file_path'] = $data[1]['media_dl'];
    $remote_url = 1;
  }
  elseif (!empty($image_row['image_download_url'])) {
/*
  MOD MEDIA SITES
  END REPLACE
*/


Step 4

In ACP (Admin Control Panel) -> Settings -> add into "Valid file extensions" list (you can add any or all, in any order):
break,
dailymotion,
hulu,
liveleak,
metacafe,
mtv,
myvideo_de,
rutube_ru,
sevenload,
spikedhumor,
stupidvideos,
yahoovideo,
youtube,
izlesene,
mynet,
onsmash,
gametrailers,
gamespot,
smotri,
collegehumor,
googlewave,
220_ro,
trilulilu_ro,
funnyordie,
dailyhaha,
megavideo,
youtube_pl,
aniboom,
vimeo,
tm_tube,
vevo,
mp3upload,
zippyshare



Step 5 (added in v1.4)

Open member.php
Find:
  $remote_media_file = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_media_file'])));
Insert below:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
  if ($media_sites_data = media_sites($remote_media_file))
    $remote_media_file = $media_sites_data[1]['media_src'];
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 5.1 (added in v1.5)

Find:
    if (!$uploaderror) {

Insert above:
/*
  MOD MEDIA SITES
  BEGIN INSERT
*/
    if (empty($new_thumb_name) && $data = media_sites_thumb($media_sites_data, $cat_id, $direct_upload))
    {
      $new_thumb_name = $data[0];
    }
/*
  MOD MEDIA SITES
  END INSERT
*/


Step 5.2 (added in v1.9)

Find:
      $media = $site_template->parse_template("media/".$file_extension);


Insert above:
/*
  MOD MEDIA SITES
  START INSERT
*/
      media_sites_template_vars($new_name);
/*
  MOD MEDIA SITES
  END INSERT
*/


Go to upload image form and use "URL:" field to upload media site videos.

Tweaks and version history in the next reply.

Attachments:

V@no:
----------------- [ Tweaks ] -----------------

Tweak 1

You can turn on/ff default autoplay by changing in includes/media_sites.php:

--- Code: ---define("MEDIA_AUTOPLAY", 1); //autoplay videos by default?

--- End code ---


Tweak 2

You can override the default autoplay by adding into the media site URL query: autoplay=1 (force enable autoplay) or autoplay=0 (force disable autoplay)
i.e.
http://www.youtube.com/watch?v=L5EpJuK91zE&autoplay=0


Tweak 3

You can specify width/height of the video by adding into media URL query width=NN and height=NN (the same way as in Tweak 2)


Tweak 4

Since version 1.4 you can use [media]media site url[/media] BBCode tags in comments and image descriptions (example: [media]http://www.youtube.com/watch?v=M-yGsP9PBrc[/media])
This feature is controlled in includes/media_sites.php by:
define("MEDIA_BBCODE", 1); //use media sites in bbcode?

To disable, replace 1 with 0


Also, each individual media site can be disabled or enabled in bbcode MEDIA_BBCODE_YES with MEDIA_BBCODE_NO in it's array description.

As an example this is array description for "liveleak" media site:

 "liveleak"      => array("#^http://(www.)?liveleak.com/view.*[?&]i=([^&]+)#i",                            2,                            "http://www.liveleak.com/e/{ID}",                            null,                            MEDIA_BBCODE_YES,                            "",                    ),
--- End code ---

Tweaks 1,2,3 also apply to BBCode.


----------------- [ Troubleshooting ] -----------------


* 404 error thumbnails
If it shows you 404 error thumbnails instead of normal thumbnails, check Step 2.x, specifically Step 2.1 and Step 4



----------------- [ Version history ] -----------------

v1.11.1 (2010-12-22) (re-do Step 1)
- Fixed: thumbnails were not created when original image is smaller then max dimentions set in 4images
- Fixed: thumbnails were not created for rutube.ru

v1.11 (2010-07-14) (more info here)
- CHANGED: thumbnail creation now using create_thumbnail() 4images function, not resize_image()
- ADDED: mp3upload.ca support
- ADDED: zippyshare support (audio only)
- REMOVED: myspacevideo support

v1.10 (2010-07-04) (more info here)
- ADDED: {media_ext} and {media_ext_icon} tags can be used to display file extension icon
- ADDED: vevo.com support (no autoplay)
- ADDED: megavideo "download" type urls (d= instead of v= url query)
- FIXED: in some cases fetching thumbnail could fail and corrupt already retreved data of the video
- FIXED: rutube.ru thumbnail creation

v1.9 (2010-02-13) (more info here)
- Fixed: wrong video or nothing showed after upload (added step 5.2)
- Added: work around if host disabled allow_url_fopen, which prevents downloading thumbnails
- Added: youtube playlist support
- Added: aniboom.com support
- Added: vimeo.com support
- Added: tm-tube.com support

v1.8 (2009-12-18) (more info here)
- Added: googlewave (experimental, must have google wave account to view)
- Added: 220.ro (video links only!)
- Added: trilulilu.ro (video links only!)
- Added: funnyordie.com
- Added: dailyhaha.com (no autoplay)
- Added: megavideo.com (no autoplay)

v1.7 (2009-11-28) (more info here)
- Added: smotri.com
- Added: collegehumor.com

v1.6 (2009-10-17) (more info here)
- Added: izlesene.com (no autoplay)
- Added: video.mynet.com
- Added: videos.onsmash.com
- Added: gametrailers.com
- Added: gamespot.com
- Fixed: break.com auto thumbnails didn't work
- Fixed: MEDIA_THUMB constant was ignored

v1.5.8 (2009-10-14) (more info here)
- Fixed: rutube.ru auto thumbnail didn't work

v1.5.7 (2009-10-13) (more info here)
- Fixed: rutube.ru didn't work

v1.5.6 (2009-06-20) (re-do Step 1)
- Added: optional Step 2.7
- Changed: mod's constants now can be copied into includes/constants.php
- Changed: template tag {is_media_site} now contains the ID of media site. can be used to display icons: {if is_media_site}<img src="icons/{is_media_site}.gif">{endif is_media_site}

v1.5.5 (2009-06-12) (re-do Step 1)
- Added: new template tag {is_media_site} can be used as conditional tag i.e. {if is_media_site}this is a media site{endif is_media_site}

v1.5 (2009-03-21) (more info here) (added Step 5.1)
- Fixed: problem with RSS feed when media site was used in a comment
- Fixed: sometimes additional options in the URL didn't work (width/height/autoplay)
- Fixed: metacafe.com didn't obey autoplay url option
- Fixed: mtv.com didn't obey autoplay options
- Added: width/height limit for BBCode
- Added: addresses to media sites home page
- Added: control for autoplay in ACP
- Added: sevenload.com support
- Added: auto thumbnails for youtube, metacafe, stupidvideos, yahoovideo, myspacevideo, liveleak, spikedhumor, myvideo.de, rutube.ru, dailymotion.com, mtv.com
- Changed: dailymotion.com doesn't require address from <embed> anymore
- Changed: break.com doesn't require address from <embed> anymore
- Changed: hulu.com doesn't require address from <embed> anymore

v1.4 (2009-03-11) (more info here) (added Step 2.6 and Step 5)
- Added fullscreen support for mtv.com
- Added ability use entire <embed> code to "upload" media sites
- Added bbcode support

v1.3 (2009-02-16)
- fixed spikedhumor.com
- added dailymotion.com (must use address from embed code)
- added mtv.com
- changed site list array to use "generic" (common) function to process most media sites.

v1.2 (2009-02-11)
- fixed unable use custom thumbnails (added Step 2.4 and Step 2.5)
- fixed myvideo.de
- added multilingual youtube support
- added rutube.ru

v1.1 (2009-02-02)
- added myvideo.de support

v1.0 (2009-02-01)
- first release (9 media sites supported)

Sunny C.:
Very Very Nice!

henkjan:
Hello guys

Is it possible to get automatic thumbnails to 4images from this media sites like Youtube?

I need this for my media site.

Regards

meier:
Hallo, was müste ich den tun das auch videos von www.myvideo.de funktionieren?

Desweiteren wird kein Vorschaubild angezeigt. An was könnte das liegen?

-----------Google Translate--------


Hello, what should I do the same videos of www.myvideo.de work?

Furthermore, there is no preview screen. In what could be the reason?

Navigation

[0] Message Index

[#] Next page

Go to full version