coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: Rinelle on August 02, 2007, 12:08:50 PM

Title: Printing high res images?
Post by: Rinelle on August 02, 2007, 12:08:50 PM
I'm trying to set up a site for download of student worksheets for printing, but so far we're having trouble getting them to print properly.  In order to get a quality printout, I need high resolution images, but when I try to print, I only get a corner of the image on the page. 

I've worked out that this is because my 300dpi images are displaying at 72dpi, and I think that in order to change this, I need to set the max display size on the large images, which should force them to print at a larger dpi, but I have no idea how to do this.  Is this possible?  Can anyone help me figure out how to do this?

Thanks for any help.

Tamara
Title: Re: Printing high res images?
Post by: Joachim Müller on August 02, 2007, 06:48:39 PM
The printing capabilities of browsers are limited. I suggested reviewing the idea of uploading images. Upload PDF files instead: they are small, ready to be printed and supported by coppermine. It's pretty easy to convert your images into PDFs on your desktop before upload (using a collection of freeware tools).
Title: Re: Printing high res images?
Post by: Rinelle on August 02, 2007, 11:27:09 PM
Thanks for that.  I have considered uploading .pdf files, unfortunately they do not display as thumbnails, making it very difficult for people to see our product before downloading.  They are also larger in size than my .jpg files (which are saved for web).

I do understand that this is a browser printing limitation rather than a coppermine limitation, however, I believe I can get around it by forcing the images to display at a4 size (595x842 pixels), which should give me the resolution I want with the file sizes I have.  I just have no idea how to change the php to do this.

Tamara
Title: Re: Printing high res images?
Post by: Nibbler on August 02, 2007, 11:57:29 PM
Use the custom thumbnail feature then. If you want to try your idea then copy/paste this code into your theme.php


function theme_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $ALBUM_SET;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;

    if (isset($_GET['picfile']))
    {
        if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

    $picfile = $_GET['picfile'];
    $picname = $CONFIG['fullpath'] . $picfile;
    $imagesize = @getimagesize($picname);
    $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    }
    elseif (isset($_GET['pid']))
    {
    $pid = (int)$_GET['pid'];
    $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='$pid' $ALBUM_SET";
    $result = cpg_db_query($sql);

    if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);

    $row = mysql_fetch_array($result);
    $pic_url = get_pic_url($row, 'fullsize');
    $geom = 'width="595" height="842"';
    $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
    }

?>
<!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=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <script type="text/javascript" src="scripts.js"></script>
  <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; height:100%; width:100%; border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  </style>
  </head>
  <body>
    <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
    </script>
    <table>
      <tr>
            <td>
          <div id="content">
              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
$imagedata['geometry']
                . 
'alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}