coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: phill104 on October 25, 2007, 12:09:04 AM

Title: Adding a bit of JavaScript
Post by: phill104 on October 25, 2007, 12:09:04 AM
I would like to add a little javascript manifier* to coppermine but I'm not quite sure how to do it or where to put the code.

In plain HTML I would use the code

<script type="text/javascript" src="tjpzoom.js"></script>

and to show the image

<div>
<img src="test.jpg" style="width:640px; height: 480px;" onmouseover="TJPzoom(this);">
</div>


For the script to run properly the image needs to be in a div tag.

Is it possible to do the above in PHP and where would I put the resulting code?

I'm guessing you have a $height and $width variable.

*The script puts a little magnifying glass over the image. I would like this to appear on the intermediate image.
Title: Re: Adding a bit of JavaScript
Post by: just_some_guy on October 25, 2007, 08:31:04 AM
Maybe try the {IMAGE} token on theme.php.

Look in theme.php and fined the array in which the {IMAGE} is defined. I think this may contain the Slide Show artribute too.
I tried this when I put some JavaScript on. Then add your onmouseover to that.

May not be best practice. Make sure to backup your files.
Title: Re: Adding a bit of JavaScript
Post by: Sami on October 25, 2007, 09:09:03 AM
Create a custom theme and put this

<script type="text/javascript" src="tjpzoom.js"></script>

under template.html

and add theme_html_picture function from themes\sample\theme.php to themes\your-theme\theme.php and change the way you want
Title: Re: Adding a bit of JavaScript
Post by: phill104 on October 25, 2007, 09:18:46 AM
Cheers guys.

It's almost working properly