General Community > WebsiteBaker Website Showcase

Historical association Staphorst -> Baked

(1/3) > >>

Aquila:
Hello WB users  :mrgreen:,

My first Baked 2.6.4 site for 'historical association Staphorst' in Netherlands. Most of you can't read it because it's in Dutch. :-P
The idea is history information about Staphorst and the activities of the association in one site. The design is traditional Staphorst + some people here wear traditional dress as you can see on the pictures.

You can find it here: http://www.historischeverenigingstaphorst.nl/

Used modules addons:
-Dutch language
-Gmapmodule
-Banmodule
-Event Calendar

Used templates:
-Allcss changed into my own templates. A big plus for this template system. Very easy to maintain!!!

I did a little tweaking of the WB system, because they were needed for functionality:
Account changes:
/account/forgot_form.php: Translated forgot mail into Dutch
/account/signup_form.php: Translated a signup form into Dutch
/account/signup2.php: Translated signup mail

Admin changes:
/admin/media/template.html: Added radiobuttons for max width,height or no image scaling. Added checkbox to add a watermark (default on).
/admin/media/upload.php: Added business for resizing and watermarking images.
/admin/interface/success.html: Changed the timeout to 10 sec. It was below 1 sec but some new front-end users didn't notice that the First-time registration was complete. I'm not happy with this, because every success event shows a 10 sec display 'success' and that is pretty boring in a back-end administration.  :|

Framework changes:
/Framework/functions.php: Added functionality for watermarking and resizing images
/Framework/api.watermark.php: Added a watermark API script found somewhere on the internet. (I lost my i.e. favorites during a harddisk crash so i can't find the url where i found it)

Modules changes:
/modules/news/view.php: Added a comment counter (script is somewhere on this forum, thx for it). And deleted some stuff that don't display [Read More] below 9 char in long post. If you implement such a thing you can't read comments either. My system allways shows a 'read more' and then you can read also the comments.
/modules/news/comment_page.php: I Hide title and there i save the users IP (for optional ban use), Weblogging or news systems don't ask a title for your message and IP-logging is a need for banning.
/modules/news/submit_comment.php: Added a notify system (script is somewhere on this forum, thx for it) that sends an e-mail to an admin when a message is placed.

Other things:
-I use phpmyvisites for counting visites, it has more functionality then a addon for WB.
-I've been thinking about writing modules of my tweaks, but i don't have any idea where to begin. I tried the Hello module as example.

11 changes total, code is clear and i can easily read it. I realise that upgrading to a new WB 2.6.5 takes a time to implement my changes.

Greetings Aquila.

ruebenwurzel:
Hello

nice baken  :-D and shows another time that WB is a system wich can easily be adapted to own requirements. Not only the templates even the core files. Good job.

Matthias

pcwacht:
Nice work, looks good.

Good use of the googlemap btw. Very clear.

I like your modifactions in the media part
admin/media/template.html: Added radiobuttons for max width,height or no image scaling
Can we have a look at that code and the code wich is needed to make it work :
/Framework/functions.php: Added functionality for watermarking and resizing images

Maybe it can be implemented in next release ;)

I found a small error in the information section beneath the menu
I would change: Aan informatie, prijzen, data kunnen  ...
to: Aan informatie, prijzen en data kunnen ... or change the 'en' to 'of'


John

kweitzel:
It is a really impressive site! and please, do share some (or all) of the code, if it can be used to improve the functionality of WB.

cheers

Klaus

Aquila:
Thx pcwacht for your input, i will change it soon.

I will share some code of the resizing and watermarking. It's not perfect, but with little changes it can be powerfull!

First of all a screenshot of my media screen in WB for the idea:

It says:
"Add a watermark to the image file"
"Use maximum width (460px)"
"Use maximum height (350px)"
"Do not change image"
The max width/height in my code is one size, fitted to my template. You could use a textfield for a different size. There is one important thing the wb-developers should think about: I also upload PDF-files with media module (with no watermark option and no image scaling, do you get the point  :wink:).

Ok now thecode samples: you can also download source and search on 'Aquila' to get the modifications.
admin/media/template.html

--- Code: ---<tr>
    <td colspan="2">
        <input type="checkbox" name="watermark" id="watermark" value="yes" checked />
        <label for="watermark">
        Voeg watermerk toe aan {TEXT_FILES}
        </label>
    </td>
</tr>
<tr>
    <td colspan="2">
        <input type="radio" name="imgscale" value="width" checked />  Gebruik maximum breedte (460px) bij {TEXT_FILES}<br />
        <input type="radio" name="imgscale" value="height" /> Gebruik maximum hoogte (350px) bij {TEXT_FILES}<br />
        <input type="radio" name="imgscale" value="none" /> Geen verandering aan grootte <br />
    </td>
</tr>

--- End code ---
You can find it here http://www.luten.eu/extend/WebsiteBaker/template.html.txt

admin/media/upload.php

--- Code: ---// Find out whether we should add a watermark or not
if($admin->get_post('watermark') != '') {
    $watermark = true;
} else {
    $watermark = false;
}

// Find out whether we should resize the image
if($admin->get_post('imgscale') != '') {
    $imgscale = $admin->get_post('imgscale');
} else {
    $imgscale = "none";
}
......//lots of code and then in upload loop
//resize image
            if(file_exists($relative.$filename) AND strcasecmp ($imgscale, "width") == 0)
            {
                 $resized = img_width($relative.$filename, 460);
                 $source = fopen($relative.$filename, 'wb');
                 fwrite($source, $resized);
                 fclose($source);
            } elseif(file_exists($relative.$filename) AND strcasecmp ($imgscale, "height") == 0)
            {
                $resized = img_height($relative.$filename, 350);
                $source = fopen($relative.$filename, 'wb');
                fwrite($source, $resized);
                fclose($source);
            }

            //add watermark
            if(file_exists($relative.$filename) AND $watermark == true)
            {
                $watermarked = add_watermark($relative.$filename, "./watermark.png");
                $source = fopen($relative.$filename, 'wb');
                fwrite($source, $watermarked);
                fclose($source);
            }


--- End code ---
you can get it here http://www.luten.eu/extend/WebsiteBaker/upload.txt

Now its time to go to farmework/functions.php

--- Code: ---include 'api.watermark.php';
...
function add_watermark($filename, $watermarkfilename)
{
    $watermark = new watermark();

    # create image objects using our user-specified images
    # NOTE: we're just going to assume we're dealing with a JPG and a PNG here - for example purposes
    $main_img_obj = imagecreatefromjpeg($filename);
    $watermark_img_obj = imagecreatefrompng($watermarkfilename);

    # create our watermarked image - set 22% alpha transparency for our watermark
    $return_img_obj = $watermark->create_watermark( $main_img_obj, $watermark_img_obj, 22 );

    # display our watermarked image - first telling the browser that it's a JPEG,
    # and that it should be displayed inline
    //header( 'Content-Type: image/jpeg' );
    //header( 'Content-Disposition: inline; filename=' . $_GET['src'] );
    ob_start();
      imagejpeg( $return_img_obj, '', 80 );
    $buffer = ob_get_contents();
    ob_end_clean();
    return $buffer;
}
function img_width($filename, $prefwidth)
{
    $srcimage = imagecreatefromjpeg($filename);
    $width  = imageSX($srcimage);
    $height = imageSY($srcimage);
    if($width > $prefwidth)
    {
        $newWidth = $prefwidth;
        $newscale = $height / $width;
        $newHeight = $newscale * $newWidth;
    }
    else
    {
        $newWidth = $width;
        $newHeight = $height;
    }
    $destimage = imagecreatetruecolor($newWidth, $newHeight);
    imagecopyresampled($destimage,$srcimage,0,0,0,0,$newWidth,$newHeight,$width,$height);
    ob_start();
    ImageJPEG($destimage, '', 99);
    $return_img_obj = ob_get_contents();
    ob_end_clean();
    return $return_img_obj;
}
function img_height($filename, $prefheight)
{
  $srcimage = imagecreatefromjpeg($filename);
  $width  = imageSX($srcimage);
  $height = imageSY($srcimage);
  if($height > $prefheight)
  {
      $newHeight = $prefheight;
      $newscale = $width / $height;
      $newWidth = $newscale * $newHeight;
  }
  else
  {
      $newWidth  = $width;
      $newHeight = $height;
  }
    $destimage = imagecreatetruecolor($newWidth, $newHeight);
    imagecopyresampled($destimage,$srcimage,0,0,0,0,$newWidth,$newHeight,$width,$height);
    ob_start();
    ImageJPEG($destimage, '', 99);
    $return_img_obj = ob_get_contents();
    ob_end_clean();
    return $return_img_obj;
}

--- End code ---
You can find it here: http://www.luten.eu/extend/WebsiteBaker/functions.txt

And last but not least the Watermark API. You can find it here: www.luten.eu/extend/WebsiteBaker/apiwatermark.txt
(Don't give me credits for this file, it's from another open-source example i can't find)

As you can see the width, height and watermark.png is hardcoded stuff  :oops:
Hope you can integrate this feature, then it's easier for me to upgrade  :-D

Navigation

[0] Message Index

[#] Next page

Go to full version