Historical association Staphorst -> Baked

snark


Argos

I must say that it would be a nice function to have default in WB...
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

snark

as this is for 2.6.4 ... is there any way to get this working in 2.7?


I am stuck here...

snark

okay sorry for digging up old s*** but it does'nt seem to shitty to me...

:-P


I wonder why these functions are not implemented in de core installation...


where do I put the watermark api file and doe sit just go by apiwatermark.php or doe it need another extention?



Aquila

Quote from: vincent on February 23, 2007, 09:00:57 AM
Thanks Klaus,
Aquila obviously didn't use the random image function. The solution in the thread you're referring at seems a little awkward to me, since you'd have to have an image for every single page you make - which is a lot of images when you're site is growing. Moreover, it doesn't seem very end-user-friendly.
In my case I modified the templates, which does work, and gives the client the possibility to attach a special template to special pages. Maybe a better solution will come around - or maybe Aguila has it... :roll:

Vincent

I've used the solution you telling here. I created 4 templates, most things are the same except the images:
-HVSBlack: entrance and register
-HVSGreen: activities, associationinformation and workgroups
-HVSYellow: Shop, Open
-HVSGmap: Special css for the gmap module and no navigation left side.

Again it's not perfect because a font change is a change at four css files. I think that this is the best solution otherwise you have to deal with pageid's and their backgrounds, and those you have to change every new page you make. Another option is randomnes, also a good idea, but that was not what i want. Now it's just simple, create a page, pick a template and ready.  :-)

Vincent

Thanks Klaus,
Aquila obviously didn't use the random image function. The solution in the thread you're referring at seems a little awkward to me, since you'd have to have an image for every single page you make - which is a lot of images when you're site is growing. Moreover, it doesn't seem very end-user-friendly.
In my case I modified the templates, which does work, and gives the client the possibility to attach a special template to special pages. Maybe a better solution will come around - or maybe Aguila has it... :roll:

Vincent

kweitzel

look in the forum for "random background" ... it's the "random image" function reworked as random background function. But that is only, if you have a need for randomness ...

On the otherhand, somebody used a small script to display a banner based on the page ID ... maybe that is more interesting for you.

cheers

Klaus

Vincent

Very nice, wel done. The code you wrote will hopefully be integrated in the next release.
I wonder how you did the different backgrounds, I suppose you didn't use just one template but assigned templates with different backgound images to your pages? If not so, I'd love to know how you did the trick.

Again: congratulations!

Vincent

Aquila

#5
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
<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>

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

admin/media/upload.php
// 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);
            }


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

Now its time to go to farmework/functions.php
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;
}

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

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

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

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

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.