sharpen images cpmfetch sharpen images cpmfetch
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

sharpen images cpmfetch

Started by dwo, April 30, 2010, 10:33:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dwo

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.


<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