forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: dwo on April 30, 2010, 10:33:06 pm

Title: sharpen images cpmfetch
Post by: dwo on April 30, 2010, 10:33:06 pm
Hello.

I fetch some large images and resize them to 500 pixel.
After resizing they often get displayed a little blurred in the browser window.

My solution to sharpen them a little bit:

1. get pixastic.custom.js from here http://www.pixastic.com/
You can create the custom.js in the download section. Just mark "pixastic core, unsharpmask, minify"

2. in your self coded .php file
a) create a class for the image file where you define the parameters of the img tag; here it is named "ihomepage"
b) include after </style> the pixastic.custom.js

In my code I fetch the last added picture in category 4, for example.


Code: [Select]
<html><head>
<style type="text/css">
img.ihomepage {width:500px; border:0px;}
</style>
<script type="text/javascript">var pixastic_parseonload = true;</script>
<script src="http://www.xyz.com/pixastic.custom.js" type="text/javascript"></script>
</head>
<?php
 
include_once "cpmfetch.php"
 
$objCpm = new cpm("cpmfetch_config.php");
 
$options = array(
 
"imagestyle" => "ihomepage",
 );
 
$objCpm->cpm_viewLastAddedMediaFrom("cat=4"11$options);
 
$objCpm->cpm_close();?>

</html>


3. search this line in cpmfetch.php and add pixastic pixastic-unsharpmask(amount=40;radius=0.3;threshold=8)

 if (array_key_exists('imagestyle',$options)) $this->styleHash['imagestyle'] = 'class="' . $options['imagestyle'] . ' pixastic pixastic-unsharpmask(amount=40;radius=0.3;threshold=8)" ';

Set the parameters how you like.

Best regards, dwo