MyBB Requests

[Plugin] Userbar Hue Changer

Submitted by Tropical, , Thread ID: 3953

Thread Closed

RE: [Plugin] Userbar Hue Changer

#21
Code:
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->modulateImage($saturation, $hue);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}
?>

Pretty much that's an example of the modulateImage

RE: [Plugin] Userbar Hue Changer

#22
19-05-2015, 12:50 PM
AndresXZ09 Wrote:
Code:
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->modulateImage($saturation, $hue);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}
?>

Pretty much that's an example of the modulateImage

And here is a demo, if needed? http://phpimagick.com/Imagick/modulateImage

RE: [Plugin] Userbar Hue Changer

#23
19-05-2015, 12:50 PM
AndresXZ09 Wrote:
Code:
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
  $imagick = new \Imagick(realpath($imagePath));
  $imagick->modulateImage($saturation, $hue);
  header("Content-Type: image/jpg");
  echo $imagick->getImageBlob();
}
?>

Pretty much that's an example of the modulateImage
Why not doing this with JS :noh:
So we won't use imagick stuff
Isn't it ?
- Web Developer & Designer

Website : https://developement.design/
Skype : ef.team
Email : [email protected]

RE: [Plugin] Userbar Hue Changer

#24
19-05-2015, 12:59 PM
DarSider Wrote:
19-05-2015, 12:50 PM
AndresXZ09 Wrote:
Code:
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
  $imagick = new \Imagick(realpath($imagePath));
  $imagick->modulateImage($saturation, $hue);
  header("Content-Type: image/jpg");
  echo $imagick->getImageBlob();
}
?>

Pretty much that's an example of the modulateImage
Why not doing this with JS :noh:
So we won't use imagick stuff
Isn't it ?
http://codepen.io/anon/pen/jEoJRJ - Edit the hue and then highlight it, looks like cancer hm? also, it's not possible to do it with JS.

RE: [Plugin] Userbar Hue Changer

#25
If you're going to use a slider to modulate the hue & saturation I guess you'll need it Tongue

RE: [Plugin] Userbar Hue Changer

OP
#26
19-05-2015, 12:50 PM
AndresXZ09 Wrote:
Code:
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
  $imagick = new \Imagick(realpath($imagePath));
  $imagick->modulateImage($saturation, $hue);
  header("Content-Type: image/jpg");
  echo $imagick->getImageBlob();
}
?>

Pretty much that's an example of the modulateImage


I have technically just made this plugin....
I am wondering where to put that piece of code?? :noh:

The places where I dunno whatto put there;; I just wrote "[ERMM... idk?]

This is my code:
PHP Code:
<?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
die(
"Direct initialization of this file is not allowed.");

// add hooks
$plugins->add_hook('usercp_start''userbarhuechanger_page');

function 
userbarhuechanger_info()
{
  return array(
    
"name"     => "Userbar Hue Changer",
    
"description"  => "Allows hue rotation of userbars",
    
"website"    => "NULL",
    
"author"    => "CallingChain",
    
"authorsite"  => "http://gamingtalks.com/index.php",
    
"version"    => "1.0",
    
"codename"   => "",
    
"compatibility" => "18*"
  
);
}

function 
userbrhuechanger_install()
{
global 
$db$lang;

// create settings group
$insertarray = array(
'name' => 'userbarhuechanger'
'title' => 'Userbar Hue Changer'
'description' => "Settings for Userbar Hue Changer"
'disporder' => 100
'isdefault' => 0
);
$gid $db->insert_query("settinggroups"$insertarray);

// add settings
$setting = array(
"sid"=> NULL,
"name"=> "userbarhuechanger_usergroups",
"title"=> "Allowed Usergroups",
"description"=> "Enter the IDs of the groups allowed to use this feature. (use \'all\' to allow everyone)",
"optionscode"=> "text",
"value"=> 'all',
"disporder"=> 1,
"gid"=> $gid
);

$db->insert_query("settings"$setting);

rebuild_settings();

// insert templates
$template = array(
"tid" => "NULL",
"title" => "userbarhuechanger",
"template" => $db->escape_string('
<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->userstyle_change_style}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
{$errors}
<form action="usercp.php?action=format" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->userbarhuechanger_change_hue}</strong></td>
</tr>
<tr>
<td class="tcat" colspan="2"><strong>{$lang->userbarhuechanger_change_hue_desc}</strong></td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="action" value="userbarhuechanger" />
<input type="submit" class="button" name="submit" value="{$lang->userbarhuechanger_submit}" />
</div>
</form>
<br />
<br />
</td>
</tr>
</table>
{$footer}
</body>
</html>
'
),
"sid" => "-1",
);
$db->insert_query("templates"$template);
}

function 
userbarhuechanger_is_installed()
{
global 
$db;

if (
$db->table_exists('userbarhuechanger'))
return 
true;

return 
false;
}

function 
userbarhuechanger_uninstall()
{
global 
$db$mybb;

/* drop table */
if ($db->table_exists('userbarhuechanger'))
$db->drop_table('userbarhuechanger');

// delete settings group
$db->delete_query("settinggroups""name = 'userbarhuechanger'");

// remove settings
$db->delete_query('settings''name IN (\'userbarhuechanger_usergroups\')');

rebuild_settings();

// delete templates
$db->delete_query('templates''title IN ( \'userbarhuechanger\')');
}

function 
userbarhuechanger_activate()
{
global 
$db$cache;

$userbarhuechanger = array();

// rebuild our userbarhuechanger cache
$query $db->query("
SELECT u.username, a.*
FROM "
.TABLE_PREFIX."userbarhuechanger a
LEFT JOIN "
.TABLE_PREFIX."users u ON (u.uid=a.uid)
"
);
while(
$user $db->fetch_array($query))
{
$userbarhuechanger[$user['username']] = array('colour' => $user['colour'], 'shadow' => $user['shadow']);
}

$cache->update('userbarhuechanger'$userbarhuechanger);
}

function 
userbarhuechanger_deactivate()
{
global 
$db;

$db->delete_query('datacache''title=\'userbarhuechanger\'');
}

function 
userbarhuechanger_check_permissions($groups_comma)
{
global 
$mybb;

if (
$groups_comma == '')
return 
false;

if (
$groups_comma == 'all')
return 
true;

$groups explode(","$groups_comma);

$ourgroups explode(","$mybb->user['additionalgroups']);
$ourgroups[] = $mybb->user['usergroup'];

if(
count(array_intersect($ourgroups$groups)) == 0)
return 
false;
else
return 
true;
}

function 
userstyle_page()
{
global 
$mybb$lang$cache$db$templates$header$headerinclude$footer$theme$usercpnav;

$lang->load("userbarhuechanger");

if(
$mybb->input['action'] != 'userbarhuechanger')
return;

if (!
$mybb->user['uid'])
error_no_permission();

if (!
userbarhuechanger_check_permissions($mybb->settings['userbarhuechanger_usergroups']))
error_no_permission();

if(
$mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

[
ERMM.... idk?]
// Update database table
$db->replace_query('userbarhuechanger', array('uid' => (int)$mybb->user['uid'], [ERRMM... idk?]

// Rebuild cache
$userbarhuechanger = array();
$query $db->query("
SELECT u.username, a.*
FROM "
.TABLE_PREFIX."userbarhuechanger a
LEFT JOIN "
.TABLE_PREFIX."users u ON (u.uid=a.uid)
"
);
while(
$user $db->fetch_array($query))
{
$userbarhuechanger[$user['username']] = array('colour' => $user['colour'], 'shadow' => $user['shadow']);
}

$cache->update('userbarhuechanger'$userbarhuechanger);

redirect("usercp.php"$lang->userbarhuechanger_success_message);
}

RE: [Plugin] Userbar Hue Changer

#27
I'm so tired to read that, but this is how I think it should be done

1.- Create the DB with the settings
2.- The filter
3.- If the user has modified his UB the UB is going to be replaced, otherwise not

And as you made it with permissions, so yeah.

So tired to write too much, sorry.

RE: [Plugin] Userbar Hue Changer

OP
#28
20-05-2015, 05:04 AM
AndresXZ09 Wrote:
I'm so tired to read that, but this is how I think it should be done

1.- Create the DB with the settings
2.- The filter
3.- If the user has modified his UB the UB is going to be replaced, otherwise not

And as you made it with permissions, so yeah.

So tired to write too much, sorry.


Explain how to do that... :noh:

I'm sorry.. just don't get what you mean/how to do that Smile

RE: [Plugin] Userbar Hue Changer

#29
You can make one but it requires too much knowledge and time.

I think AmN can make one in 2 to 3 hrs so if you can pay 20-30 $ then buy one.

RE: [Plugin] Userbar Hue Changer

#30
20-05-2015, 04:57 AM
Tropical Wrote:
19-05-2015, 12:50 PM
AndresXZ09 Wrote:
Code:
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
  $imagick = new \Imagick(realpath($imagePath));
  $imagick->modulateImage($saturation, $hue);
  header("Content-Type: image/jpg");
  echo $imagick->getImageBlob();
}
?>

Pretty much that's an example of the modulateImage


I have technically just made this plugin....
I am wondering where to put that piece of code?? :noh:

The places where I dunno whatto put there;; I just wrote "[ERMM... idk?]

This is my code:
PHP Code:
<?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
die(
"Direct initialization of this file is not allowed.");

// add hooks
$plugins->add_hook('usercp_start''userbarhuechanger_page');

function 
userbarhuechanger_info()
{
  return array(
    
"name"     => "Userbar Hue Changer",
    
"description"  => "Allows hue rotation of userbars",
    
"website"    => "NULL",
    
"author"    => "CallingChain",
    
"authorsite"  => "http://gamingtalks.com/index.php",
    
"version"    => "1.0",
    
"codename"   => "",
    
"compatibility" => "18*"
  
);
}

function 
userbrhuechanger_install()
{
global 
$db$lang;

// create settings group
$insertarray = array(
'name' => 'userbarhuechanger'
'title' => 'Userbar Hue Changer'
'description' => "Settings for Userbar Hue Changer"
'disporder' => 100
'isdefault' => 0
);
$gid $db->insert_query("settinggroups"$insertarray);

// add settings
$setting = array(
"sid"=> NULL,
"name"=> "userbarhuechanger_usergroups",
"title"=> "Allowed Usergroups",
"description"=> "Enter the IDs of the groups allowed to use this feature. (use \'all\' to allow everyone)",
"optionscode"=> "text",
"value"=> 'all',
"disporder"=> 1,
"gid"=> $gid
);

$db->insert_query("settings"$setting);

rebuild_settings();

// insert templates
$template = array(
"tid" => "NULL",
"title" => "userbarhuechanger",
"template" => $db->escape_string('
<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->userstyle_change_style}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
{$errors}
<form action="usercp.php?action=format" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->userbarhuechanger_change_hue}</strong></td>
</tr>
<tr>
<td class="tcat" colspan="2"><strong>{$lang->userbarhuechanger_change_hue_desc}</strong></td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="action" value="userbarhuechanger" />
<input type="submit" class="button" name="submit" value="{$lang->userbarhuechanger_submit}" />
</div>
</form>
<br />
<br />
</td>
</tr>
</table>
{$footer}
</body>
</html>
'
),
"sid" => "-1",
);
$db->insert_query("templates"$template);
}

function 
userbarhuechanger_is_installed()
{
global 
$db;

if (
$db->table_exists('userbarhuechanger'))
return 
true;

return 
false;
}

function 
userbarhuechanger_uninstall()
{
global 
$db$mybb;

/* drop table */
if ($db->table_exists('userbarhuechanger'))
$db->drop_table('userbarhuechanger');

// delete settings group
$db->delete_query("settinggroups""name = 'userbarhuechanger'");

// remove settings
$db->delete_query('settings''name IN (\'userbarhuechanger_usergroups\')');

rebuild_settings();

// delete templates
$db->delete_query('templates''title IN ( \'userbarhuechanger\')');
}

function 
userbarhuechanger_activate()
{
global 
$db$cache;

$userbarhuechanger = array();

// rebuild our userbarhuechanger cache
$query $db->query("
SELECT u.username, a.*
FROM "
.TABLE_PREFIX."userbarhuechanger a
LEFT JOIN "
.TABLE_PREFIX."users u ON (u.uid=a.uid)
"
);
while(
$user $db->fetch_array($query))
{
$userbarhuechanger[$user['username']] = array('colour' => $user['colour'], 'shadow' => $user['shadow']);
}

$cache->update('userbarhuechanger'$userbarhuechanger);
}

function 
userbarhuechanger_deactivate()
{
global 
$db;

$db->delete_query('datacache''title=\'userbarhuechanger\'');
}

function 
userbarhuechanger_check_permissions($groups_comma)
{
global 
$mybb;

if (
$groups_comma == '')
return 
false;

if (
$groups_comma == 'all')
return 
true;

$groups explode(","$groups_comma);

$ourgroups explode(","$mybb->user['additionalgroups']);
$ourgroups[] = $mybb->user['usergroup'];

if(
count(array_intersect($ourgroups$groups)) == 0)
return 
false;
else
return 
true;
}

function 
userstyle_page()
{
global 
$mybb$lang$cache$db$templates$header$headerinclude$footer$theme$usercpnav;

$lang->load("userbarhuechanger");

if(
$mybb->input['action'] != 'userbarhuechanger')
return;

if (!
$mybb->user['uid'])
error_no_permission();

if (!
userbarhuechanger_check_permissions($mybb->settings['userbarhuechanger_usergroups']))
error_no_permission();

if(
$mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

[
ERMM.... idk?]
// Update database table
$db->replace_query('userbarhuechanger', array('uid' => (int)$mybb->user['uid'], [ERRMM... idk?]

// Rebuild cache
$userbarhuechanger = array();
$query $db->query("
SELECT u.username, a.*
FROM "
.TABLE_PREFIX."userbarhuechanger a
LEFT JOIN "
.TABLE_PREFIX."users u ON (u.uid=a.uid)
"
);
while(
$user $db->fetch_array($query))
{
$userbarhuechanger[$user['username']] = array('colour' => $user['colour'], 'shadow' => $user['shadow']);
}

$cache->update('userbarhuechanger'$userbarhuechanger);

redirect("usercp.php"$lang->userbarhuechanger_success_message);
}


PHP Code:
$userbarhuechanger[$user['username']] = array('colour' => $user['colour'], 'shadow' => $user['shadow']); 

seems legit...

Users browsing this thread: 5 Guest(s)