Problem with full-sized photos Problem with full-sized photos
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Problem with full-sized photos

Started by Daniil, June 06, 2010, 08:58:56 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Daniil

After I updated my Coppermine to the latest 1.5.4 a problem with full-sized photos appeared. Big photos (HQ, UHQ) aren't showed as they should. I attached a screenshot. You also can try http://gallery.heygaga.ru/displayimage.php?album=lasthits&cat=0&pid=1209#top_display_media [Edit Joachim] Warning: link not safe for work [/Edit]. As you can see, when the image is loading pop-up is big as it should, but when the photo is loaded pop-up becomes small. I don't like it and users also.

phill104

That is a browser function, not a coppermine issue.
It is a mistake to think you can solve any major problems just with potatoes.

Daniil

Quote from: Phill Luckhurst on June 06, 2010, 09:06:15 PM
That is a browser function, not a coppermine issue.
Why in all 1.4 galleries I didn't meet such problem, but in all 1.5 galleries it appears? I can see it and in Firefox, and in IE 8.

anna.

I have the same problem, it's not exactly a problem but in previous version the picture did show as big as it was a now it resizes and it's be confusing for users as they think the picture is small.

Joachim Müller

Uploading 1.880px × 3.000px images and not force-resizing them is not a bright idea and a waste of recources and band-width. I can't replicate your issues though - the browsers I have access to work exactly as expected.
Please repect board rules in the future:

  • @Daniil: always post a warning with the link to your gallery if it contains adult content, even if it is mild nudity or babe poses. I have edited your posting accordingly
  • @anna.: please respect board rules in the first place - posting a link to your gallery is mandatory. If your issue differs, don't hijack someone else's thread but start a thread of your own

Daniil

Quote from: Joachim Müller on June 07, 2010, 08:12:13 AM
Uploading 1.880px × 3.000px images and not force-resizing them is not a bright idea and a waste of recources and band-width. I can't replicate your issues though - the browsers I have access to work exactly as expected.
I want to say that if a person is clicking on the image, he wants to see a HQ and large image. And in Coppermine 1.5.4. pop-up opens full-sized photo and after it makes smaller. So, what's the sense of full-sized photos if they become like simple.

Αndré

Quote from: Daniil on June 07, 2010, 11:38:54 AM
in Coppermine 1.5.4. pop-up opens full-sized photo and after it makes smaller
I can confirm that behavior on your website, but not on my local testbed. Please upgrade to cpg1.5.6 and post the content of your theme.php, if any.

Daniil

Quote from: Αndré on June 07, 2010, 12:28:12 PM
I can confirm that behavior on your website, but not on my local testbed. Please upgrade to cpg1.5.6 and post the content of your theme.php, if any.

I upgraded to cpg1.5.6. The problem also appears. I've tried new curve theme, there this problem also is.

The content of theme.php in my theme:

<?php
define('THEME_IS_XHTML10_TRANSITIONAL',1);
?>


P.S. Have you tried to open big photos, not small?


Αndré

Quote from: Daniil on June 07, 2010, 01:11:32 PM
Have you tried to open big photos, not small?
Yes. I just uploaded your picture to my gallery.

Enable Insert a transparent overlay to minimize image theft and your problem should be solved.

Daniil

Quote from: Αndré on June 07, 2010, 01:56:54 PM
Yes. I just uploaded your picture to my gallery.

Enable Insert a transparent overlay to minimize image theft and your problem should be solved.

Yes. Now it's ok. But a lot of people use photos from my gallery. What should they do now?

Αndré

Have a look at the function theme_display_fullsize_pic and adjust it to your needs (copy it to your theme.php file). Compare the content of $fullsize_html in case of enabled/disabled overlay.

Daniil

Quote from: Αndré on June 07, 2010, 02:19:30 PM
Have a look at the function theme_display_fullsize_pic and adjust it to your needs (copy it to your theme.php file). Compare the content of $fullsize_html in case of enabled/disabled overlay.

Which files should I edit?

Αndré


Daniil

Quote from: Αndré on June 07, 2010, 02:56:24 PM
http://gallery.heygaga.ru/themes/classic/theme.php
i've added theme_display_fullsize_pic to this file and Gallery doesn't open. Just an error is on the screen. Please, say what exactly should i add to theme.php file.

Αndré

Copy the whole function theme_display_fullsize_pic from themes/sample/theme.php to themes/your_theme/theme.php. Please also use the board search, as this has been asked so many times before.

Daniil

Quote from: Αndré on June 07, 2010, 03:04:10 PM
Copy the whole function theme_display_fullsize_pic from themes/sample/theme.php to themes/your_theme/theme.php. Please also use the board search, as this has been asked so many times before.

I've added this to theme.php and there's no difference(((


/******************************************************************************
** Section <<<theme_display_fullsize_pic>>> - START
******************************************************************************/
// Display the full size image
function theme_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $FORBIDDEN_SET, $LINEBREAK, $pid;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;

    $superCage = Inspekt::makeSuperCage();

    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
        printf($lang_errors['login_needed'],'','','','');
        die();
    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
        printf($lang_errors['access_intermediate_only'],'','','','');
        die();
    }
    if ($superCage->get->keyExists('picfile')) {
        if (!GALLERY_ADMIN_MODE) {
            cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
        }
        //$picfile = $_GET['picfile'];
        //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities
        $matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z\/_.-]+$/');
        $picfile = $matches[0];
        $picname = $CONFIG['fullpath'] . $picfile;
        $imagesize = @getimagesize($picname);
        $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif ($pid) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE pid='$pid' $FORBIDDEN_SET";
        $result = cpg_db_query($sql);
        if (!mysql_num_rows($result)) {
            cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $row = mysql_fetch_assoc($result);
        $pic_url = get_pic_url($row, 'fullsize');
        $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
        $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
    }
    if ((!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) || (USER_ID && USER_ACCESS_LEVEL <= 2)) {
        // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message
        $row['pwidth'] = 200;
        $row['pheight'] = 100;
    }

    $charset = ($CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']);
    $fullsize_html = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=$charset" />
        <title>{$CONFIG['gallery_name']}: {$lang_fullsize_popup['click_to_close']}</title>
        <style type="text/css">
            body { margin: 0; padding: 0; background-color: gray; }
            img { margin:0; padding:0; border:0; }
            #content { margin:0 auto; padding:0; border:0; }
            table { border:0; width:{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse}
            td { vertical-align: middle; text-align:center; }
        </style>

        <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script>
        <script type="text/javascript" src="js/displayimage.fullsize.js"></script>
    </head>
    <body style="margin:0px; padding:0px; background-color: gray;">

EOT;
    if ($CONFIG['transparent_overlay'] == 1) {
        $fullsize_html .= <<<EOT
        <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;">
            <tr>

EOT;
        $fullsize_html .=  '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">';
        $fullsize_html .=  '<div id="content">';
        $fullsize_html .=  '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id='
                . floor(rand()*1000+rand())
                . '&amp;fullsize=yes" '
                . $imagedata['geometry']
                . ' alt="'
                . htmlspecialchars($imagedata['name'])
                . '" title="'
                . htmlspecialchars($imagedata['name'])
                . $LINEBREAK . $lang_fullsize_popup['click_to_close']
                . '" /></a><br />' . $LINEBREAK;
        $fullsize_html .=  <<<EOT
                    </div>
                </td>
            </tr>
        </table>

EOT;
    } else {
        $fullsize_html .=  '        <div id="content">'.$LINEBREAK;
        $fullsize_html .=  '<a href="javascript: window.close()"><img src="'
        . htmlspecialchars($imagedata['path']) . '" '
        . $imagedata['geometry']
        . 'id="fullsize_image" alt="'
        . htmlspecialchars($imagedata['name'])
        . '" title="'
        . htmlspecialchars($imagedata['name'])
        . $LINEBREAK . $lang_fullsize_popup['click_to_close']
        . '" /></a><br />' . $LINEBREAK
        . '        </div>'.$LINEBREAK;
    }
    $fullsize_html .= <<<EOT
  </body>
</html>

EOT;

    $fullsize_html = CPGPluginAPI::filter('fullsize_html', $fullsize_html);
    echo $fullsize_html;
}
/******************************************************************************
** Section <<<theme_display_fullsize_pic>>> - END
******************************************************************************/


Now my theme.php looks like:

<?php
define
('THEME_IS_XHTML10_TRANSITIONAL',1);


/******************************************************************************
** Section <<<theme_display_fullsize_pic>>> - START
******************************************************************************/
// Display the full size image
function theme_display_fullsize_pic()
{
    global 
$CONFIG$THEME_DIR$FORBIDDEN_SET$LINEBREAK$pid;
    global 
$lang_errors$lang_fullsize_popup$lang_charset;

    
$superCage Inspekt::makeSuperCage();

    if (!
USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
        
printf($lang_errors['login_needed'],'','','','');
        die();
    } elseif (
USER_ID && USER_ACCESS_LEVEL <= 2) {
        
printf($lang_errors['access_intermediate_only'],'','','','');
        die();
    }
    if (
$superCage->get->keyExists('picfile')) {
        if (!
GALLERY_ADMIN_MODE) {
            
cpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);
        }
        
//$picfile = $_GET['picfile'];
        //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities
        
$matches $superCage->get->getMatched('picfile''/^[0-9A-Za-z\/_.-]+$/');
        
$picfile $matches[0];
        
$picname $CONFIG['fullpath'] . $picfile;
        
$imagesize = @getimagesize($picname);
        
$imagedata = array('name' => $picfile'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif (
$pid) {
        
$sql "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " "WHERE pid='$pid$FORBIDDEN_SET";
        
$result cpg_db_query($sql);
        if (!
mysql_num_rows($result)) {
            
cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);
        }
        
$row mysql_fetch_assoc($result);
        
$pic_url get_pic_url($row'fullsize');
        
$geom 'width="' $row['pwidth'] . '" height="' $row['pheight'] . '"';
        
$imagedata = array('name' => $row['filename'], 'path' => $pic_url'geometry' => $geom);
    }
    if ((!
USER_ID && $CONFIG['allow_unlogged_access'] <= 2) || (USER_ID && USER_ACCESS_LEVEL <= 2)) {
        
// adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message
        
$row['pwidth'] = 200;
        
$row['pheight'] = 100;
    }

    
$charset = ($CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset']);
    
$fullsize_html = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=
$charset" />
        <title>
{$CONFIG['gallery_name']}{$lang_fullsize_popup['click_to_close']}</title>
        <style type="text/css">
            body { margin: 0; padding: 0; background-color: gray; }
            img { margin:0; padding:0; border:0; }
            #content { margin:0 auto; padding:0; border:0; }
            table { border:0; width:
{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse}
            td { vertical-align: middle; text-align:center; }
        </style>

        <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script>
        <script type="text/javascript" src="js/displayimage.fullsize.js"></script>
    </head>
    <body style="margin:0px; padding:0px; background-color: gray;">

EOT;
    if (
$CONFIG['transparent_overlay'] == 1) {
        
$fullsize_html .= <<<EOT
        <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;">
            <tr>

EOT;
        
$fullsize_html .=  '<td align="center" valign="middle" background="' htmlspecialchars($imagedata['path']) . '" ' $imagedata['geometry'] . ' class="image">';
        
$fullsize_html .=  '<div id="content">';
        
$fullsize_html .=  '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id='
                
floor(rand()*1000+rand())
                . 
'&amp;fullsize=yes" '
                
$imagedata['geometry']
                . 
' alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
$LINEBREAK $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' $LINEBREAK;
        
$fullsize_html .=  <<<EOT
                    </div>
                </td>
            </tr>
        </table>

EOT;
    } else {
        
$fullsize_html .=  '        <div id="content">'.$LINEBREAK;
        
$fullsize_html .=  '<a href="javascript: window.close()"><img src="'
        
htmlspecialchars($imagedata['path']) . '" '
        
$imagedata['geometry']
        . 
'id="fullsize_image" alt="'
        
htmlspecialchars($imagedata['name'])
        . 
'" title="'
        
htmlspecialchars($imagedata['name'])
        . 
$LINEBREAK $lang_fullsize_popup['click_to_close']
        . 
'" /></a><br />' $LINEBREAK
        
'        </div>'.$LINEBREAK;
    }
    
$fullsize_html .= <<<EOT
  </body>
</html>

EOT;

    
$fullsize_html CPGPluginAPI::filter('fullsize_html'$fullsize_html);
    echo 
$fullsize_html;
}
/******************************************************************************
** Section <<<theme_display_fullsize_pic>>> - END
******************************************************************************/

?>



Why don't I see the result?(((

Αndré

Quote from: Daniil on June 07, 2010, 03:15:27 PM
Why don't I see the result?
Read my instructions carefully!
Quote from: Αndré on June 07, 2010, 02:19:30 PM
adjust it to your needs [..] Compare the content of $fullsize_html in case of enabled/disabled overlay