Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Adding a bit of JavaScript  (Read 2476 times)

0 Members and 1 Guest are viewing this topic.

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Adding a bit of JavaScript
« 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

Code: [Select]
<script type="text/javascript" src="tjpzoom.js"></script>

and to show the image

Code: [Select]
<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.
« Last Edit: October 25, 2007, 10:07:11 am by Sami »
Logged
It is a mistake to think you can solve any major problems just with potatoes.

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Adding a bit of JavaScript
« Reply #1 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.
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Adding a bit of JavaScript
« Reply #2 on: October 25, 2007, 09:09:03 am »

Create a custom theme and put this
Code: [Select]
<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
Logged
‍I don't answer to PM with support question
Please post your issue to related board

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Adding a bit of JavaScript
« Reply #3 on: October 25, 2007, 09:18:46 am »

Cheers guys.

It's almost working properly
Logged
It is a mistake to think you can solve any major problems just with potatoes.
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 16 queries.