Fix Signature Images » DataLife Engine Support

DLEVIET - DataLife Engine Support Home Page

DataLife Engine Support » DataLife Engine » Edit Code » Fix Signature Images

Fix Signature Images

  • Author: admin;  
  • Views: 1867;  
  • Date: 25 September 2009;  
Fix Signature Images

DLE don't control the size of signature images. That is a big problem. Member can upload a big image. For example : 1024 x 768.
With this h@ck, we will solve this problem and it apply to all version of DLE.


GO GO GO

1. Open file /modules/profile.php

find
$stop .= $lang['news_err_22'];


Below Add

// Fix Signature Images
$replace_a = preg_replace ("'.*?\\[url.*?\\](.*?)\\[/url\\].*?'si", "\\1", $_POST['signature']); // get code pictures in signature
$replace = preg_replace ("'.*?\\[img.*?\\](.*?)\\[/img\\].*?'si", "\\1", $replace_a);  // Now get links of them

$explode = explode (" ", $replace); // We divide the resulting string of different images
$count = count ($explode); // count images

foreach (range(0, $count-1) as $number) // Being put in the meter
{
    $link = $explode[$number]; // Final link
    $name = basename ($link); // Name pictures

    $type = explode (".", $name); // Get extension
    $end = end ($type); // We turn now to the last element

    if ($end == "jpg") $img = @imagecreatefromjpeg ($name); // Create images
    if ($end == "gif") $img = @imagecreatefromgif ($name);
    if ($end == "png") $img = @imagecreatefrompng ($name);
    if ($end == "bmp") $img = @imagecreatefrombmp ($name);

    if ($img) // Check, got-it
    {
        $width = @imagesx ($img); // Get width of the picture
        $height = @imagesy ($img); // Get height of the picture
        if ($width > 350 or $height > 19) // We compare
        {
            $find = array ('{%name%}', '{%width%}', '{%height%}');
            $replace = array ($name, "350", "19");
            $mess_error = str_replace ($find, $replace, $lang['reg_pic_big']);
            $stop .= $mess_error;
        }
    }
}
// Fix Signature Images


2. Open file language/English/website.lng

find
'pm_del'            =>    "Remove",


Below Add

'reg_pic_big' => "<li>Image  <b>{%name%}</b> too much! Image size in signature could not be more  {%width%} width, and {%height%} height</li>",


3. Go back to step 1 and see 350 and 19. You can change "350" and "19" on the maximum size you needed. Can be done in the admin panel, but I was too lazy smile
We encourage you to Register or Login to website under your name.

james

Posted 18 April 2010 01:24 Register: 13.04.2010
How to display sign below post??
Information
Members of Guest cannot leave comments.

Pagerank Update

    Updates Yandex SEO
    13.04.2012
    16.02.2012
    04.02.2012
    Updates Yandex search
    17.05.2012
    15.05.2012
    12.05.2012
    Updates Yandex Catalogue
    18.05.2012
    16.05.2012
    11.05.2012
    Updates Google
    03.05.2012
    06.02.2012
    08.11.2011

Find us on Facebook

Poll

How do you know DataLife Engine Support?

Search Engine
Other DLE Support websites
Forum
Friends
Others

Sponsor

Calendar

«    May 2012    »
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
Contact us in social network

Facebook

Twitter