[PlusEMU][Addon] User's avatar in alert

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
That is just plain stupid. If you got a 100 user base, that will be a 100 curls within few seconds, instead of caching it / save the image in a folder, so you don't have to overkill the curl totally, and then automatically next time if the user has changed figure, you just delete the old one from the images folder.

If you're interested I can code this to 100% functionality once I get to work.

Avatar Retros is stupid it sometimes require authentication because of CF services.

Sent from my SM-G928F using Tapatalk
pls do
 
This will work:
PHP:
<?php

    if(!isset($_GET["fig"]) || empty($_GET["fig"])) {
        echo "No fig request";
        exit;
    }
$fig = $_GET['fig'];
$fig .= str_replace("_", ".", $fig);
$ch = curl_init("http://www.habbo.com/habbo-imaging/avatarimage?figure=$fig&action=wlk&direction=2&head_direction=3&gesture=sml&size=l");
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER         => false,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_ENCODING       => "",
        CURLOPT_USERAGENT      => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
        CURLOPT_AUTOREFERER    => true,
        CURLOPT_SSL_VERIFYPEER => false
    ));

    $content = curl_exec($ch);
    $type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);

    curl_close($ch);

    if(!isset($content) || empty($content) || strpos($content, 'Not Found') !== false) {
        echo "Not found!";
        exit;
    }
  
    header("Content-Type: {$type}");

    echo $content;
?>
also fyi that doesn't work either
 

Core

Member
Nov 10, 2016
356
138
pls do
 

also fyi that doesn't work either

Test it in the browser to see if your rewrite rules are actually working.
Also in terms of caching just use imgpng(.., name); and then file_exists to check if it exists.
No need for so big complex caching system as the return data should never change for the figure (as long as the GET request doesn't change).
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
Test it in the browser to see if your rewrite rules are actually working.
Also in terms of caching just use imgpng(.., name); and then file_exists to check if it exists.
No need for so big complex caching system as the return data should never change for the figure (as long as the GET request doesn't change).
I did, works fine but when it sends the data from the emulatornit replaces all the . In the figure data code with _ so it's not showing the image
 

Core

Member
Nov 10, 2016
356
138
I did, works fine but when it sends the data from the emulatornit replaces all the . In the figure data code with _ so it's not showing the image

rip.. that's weird works for me
try using stri_replace?
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
nah it still seems to be replacing it, I did have one that worked before but for some reason it wont work for me anymore
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
<rule name="rule figure">
<match url="^c_images/notifications/fig/([A-Za-z0-9-\.]+).png(|/)$" />
<action type="Rewrite" url="notifications/user.php?fig={R:1}" appendQueryString="false" />
</rule>
 

Core

Member
Nov 10, 2016
356
138
<rule name="rule figure">
<match url="^c_images/notifications/fig/([A-Za-z0-9-\.]+).png(|/)$" />
<action type="Rewrite" url="notifications/user.php?fig={R:1}" appendQueryString="false" />
</rule>

The issue could be the regular expression, it's not allowing a - by default? Well, at least in apachie based servers using htaccess, that wouldn't work

Or a 100% fix would be using url encode and decode.
 

BigG

New Member
Oct 9, 2016
7
0
Use a web.config instead of htaccess if using IIS.
I'm using already web.config 'cause I use IIS. I converted the .htaccess using url rewrite but that is the result ^^
You got a web.config for me so I can test it?
Tks :up:
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
If anyone is having any issues with this on IIS I managed to fix it by using this rewrite rule
Code:
<rule name="rule figure">
                    <match url="^c_images/notifications/fig/([^/]+).png" />
                    <action type="Rewrite" url="/notifications/user.php?fig={R:1}"/>
                </rule>

and also adding
Code:
$fig .= str_replace("_", ".", $fig);
underneath
Code:
$fig = $_GET['fig'];
 

Users who are viewing this thread

Top