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 2 [3] 4   Go Down

Author Topic: Image manipulation for cpg1.5.x  (Read 85003 times)

0 Members and 1 Guest are viewing this topic.

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #40 on: January 15, 2010, 03:37:56 pm »

@Joachim:
Your changes in install/uninstall functions seems to have introduced a bug for me, see screen shot. I assume it's again a wrong cr/lf thing (see screen shot), but even if I correct it, I get

Code: [Select]
While executing query 'UPDATE cpg15x_config SET value= WHERE name='transparent_overlay'' in plugins/image_manipulation/codebase.php on line 171

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE name='transparent_overlay'' at line 1

everytime trying to uninstall the plugin.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Image manipulation for cpg1.5.x
« Reply #41 on: January 16, 2010, 10:28:31 am »

Not sure what went wrong. Please try rev 7066.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #42 on: January 16, 2010, 02:07:39 pm »

Fixed in SVN
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Image manipulation for cpg1.5.x
« Reply #43 on: January 16, 2010, 03:50:59 pm »

Okay here is what I found out using v1.8.

View an intermediate sized picture. Everything works fine.
Then (using Firefox) press ctrl+shift+r or ctrl+f5 (with that shortcuts you reload the page without loading data from the cache). Now the different effects will be applied after each other.
Now press f5 or call the page again. Everything works fine.

I cannot replicate that behavior in Chrome, as I don't know the correct shortcuts or the bug doesn't exist there.
Can someone confirm that behavior? I cannot reproduce it without the mentioned page reload, even if I remove the <button> tags.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #44 on: January 16, 2010, 07:51:07 pm »

That's correct, behaves here the same way, but only after force reload.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Image manipulation for cpg1.5.x
« Reply #45 on: January 17, 2010, 10:42:47 am »

I removed the <button> tags from the sliders in r7080. I cannot determine any unexpected behavior. Can everyone please test if the effects are applied simultaneously and not one after each other? Thanks.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #46 on: January 17, 2010, 10:50:19 am »

Works, but doesn't look nice with my skin (or classic) because you removed the button class and now the font of the LED description is different from the button description.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Image manipulation for cpg1.5.x
« Reply #47 on: January 17, 2010, 11:11:56 am »

You're right. I hadn't noticed that. Changed in r7081.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #48 on: January 17, 2010, 12:05:16 pm »

Released v2.0. I don't think there's much more room for improvement to be honest.
Logged

dougyang83

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Image manipulation for cpg1.5.x
« Reply #49 on: January 25, 2010, 09:27:18 am »

nothing happen... something wrong?
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Image manipulation for cpg1.5.x
« Reply #50 on: January 25, 2010, 09:29:27 am »

nothing happen... something wrong?

Is that supposed to be a test report? You should be aware that there is currently no support for CPG1.5.x. Additionally you should read the board rules - http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Image manipulation for cpg1.5.x
« Reply #51 on: January 25, 2010, 11:26:57 am »

That guy is a board spammer. I'm just currently deleting his postings and banning him.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Image manipulation for cpg1.5.x
« Reply #52 on: January 27, 2010, 12:04:09 pm »

I noticed an issue.

Set 'Use cookies' to 'Yes' and login as admin or user. Now view some pictures (in my case I try to view a whole album, start at the first image and click 'next', 'next', 'next', ...).

After a few pictures (sometimes 1, sometimes >50) I get logged out. Reason: the session cookie will be updated (or a new one is created and the old one deleted, I'm not sure). The client_id (cookie name) stays the same, but the session_id (cookie value) differs.

I haven't figured out why it happens. Everything works fine if you disable the cookie usage in the plugin configuration.

Can someone confirm that issue? I tested it with Firefox 3.5, Chrome 3, IE6 and IE8 on my online gallery (updated from 1.3.x -> 1.4.x -> 1.5.x) with lots of plugins and on a new local installation without any other plugin installed.


I've attached 3 screen shots of my Firefox cookie console (if you keep it opened while surfing, it doesn't remove 'old' cookies. If I re-open my cookie console, only one cookie (the latest) exists).


Edit: I've traced it back to that function
Code: (plugins/image_manipulation/js/image_manipulation.js) [Select]
function im_createCookie(im_name,im_value) {
    var im_date = new Date();
    im_date.setTime(im_date.getTime()+62208000000);
    var im_expires = "; expires="+im_date.toGMTString();
    document.cookie = im_name+"="+im_value+im_expires+"; path=/";
}
Maybe it's better to save only one cookie that consists an encoded array instead of saving one cookie per image?
« Last Edit: January 27, 2010, 12:27:35 pm by Αndré »
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #53 on: January 28, 2010, 03:58:11 pm »

Please check the current SVN version, try it out and give some feedback if it improves things for you and if it works correctly.
It is impossible to save all data to just one cookie (max cookie size is 4096 byte). So the script will now use one cookie per 100 files, meaning
0 <= pid < 100 is saved in cookie im_0
100 <= pid < 200 is saved in cookie im_1
200 <= pid < 300 is saved in cookie im_2
...
So the number of cookies has dropped to a hundredth. Hopefully this won't overstrain Firefox anymore.  ;)
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #54 on: January 28, 2010, 04:05:49 pm »

BTW:
Number of cookies per domain allowed in modern browsers are
IE7/IE8 => 50
Firefox => 50
Opera => 30
Safari => no limit

If you set more cookies, the oldest ones will be deleted. So the new cookie solution will work for galleries with 4500 files without a problem in most browsers, but afterwards we're in trouble again... In the long run, it would be sensible to save the value in the database via PHP / AJAX.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Image manipulation for cpg1.5.x
« Reply #55 on: January 28, 2010, 04:39:49 pm »

What do you propose, adding it to the users table? Could lead to some very big databases. Maybe have an admin tool to clear data for any user that has not visited for x days.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Image manipulation for cpg1.5.x
« Reply #56 on: January 28, 2010, 04:48:20 pm »

Seems to work better now. I've viewed about 400 pictures and didn't get logged out.

I suggest adding the data to the cookie only if the user has manipulated the image (value != 0). Currently I have cookie contents like
Code: (Cookie 'im_877') [Select]
_87753_0_87754_0_87755_0_87756_0_87757_0_87758_0_87759_0_87760_0_87761_0_87762_0_87763_0_87764_0_87765_0_87766_0_87767_0_87768_0_87769_0_87770_0_87771_0_87772_0_87773_0_87774_0_87775_0_87776_0_87777_0_87778_0_87779_0_87780_0_87781_0_87782_0_87783_0_87784_0_87785_0_87786_0_87787_0_87788_0_87789_0_87790_0_87792_0_87793_0_87794_0_87795_0_87796_0_87797_0_87798_0_87799_0_87701_0_87703_0_87705_0_87707_0_87709_0_87711_0_87713_0_87715_0_87717_0_87719_0_87721_0_87723_0_87725_0_87727_0_87729_0_87730_0_87731_0_87732_0_87733_0_87734_0_87735_0_87736_0_87737_0_87738_0_87739_0_87740_0_87741_0_87742_0_87744_0_87745_0_87746_0_87747_0_87748_0_87749_0_87750_0_87751_0_87752_0
Furthermore you could store only the pid%100 instead of the whole pid (i.e. if the pid is 87753 and the cookie name is im_877 you store only '53') and then drop one underscore to save some space.

Example.
Now:
Code: (Cookie 'im_877') [Select]
_87753_0_87754_0_87755_0_87756_0_87757_0
With my suggestion:
Code: (Cookie 'im_877') [Select]
530_540_550_560_570

What do you propose, adding it to the users table? Could lead to some very big databases.
Yes. That should be configurable in the plugin config. First we need to change the code in a way, that it don't stores unmanipulated images (value = 0).
If you think of exif data and hit/voting stats tables, we already have some space consumer. But that's the decision of the webmaster.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #57 on: January 28, 2010, 04:54:37 pm »

Just did that and encoded the values with toString / parseInt so we have now 400 pids per cookie. Meaning it will work in galleries with up to 18000 pid's. Values of 0 are not saved anymore. I think that's enough for most purposes.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Image manipulation for cpg1.5.x
« Reply #58 on: January 28, 2010, 05:01:31 pm »

I second Phill's suggestion to store stuff inside the database and not inside the cookie. Pruning old records in the database is of course mandatory. This should take care of registered users, which is our target audience imo. The feature to store something is not that important for guests imo - we could store some stuff inside a cookie for the guests, but ideally only a unique visitor ID that correlates to the database table that actually stores the per pic preferences.
If you decide to implement storage inside the database I suggest to ask the admin on the plugin's config screen what amount of records should be kept before the pruning of older records (the database garbage collection) kicks in. You could provide an estimate there as well about the space consumption of those records inside the database.
However, I suggest coming up with a database table of it's own instead of using the user table - to keep our table clean. Additional benefit would be that the unique ID for the guest and subsequently storage of the guest records inside the database could be implemented that way as well.
Using more than one cookie is bad design imo and should be discarded.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Image manipulation for cpg1.5.x
« Reply #59 on: January 28, 2010, 05:13:39 pm »

Might be a good way to handle it, but this would produce one AJAX request everytime a button or LED slider is touched.  :o
I think that's just plain overkill for many servers, and it certainly would drop the performance of the plugin in a negative way.
Logged
Pages: 1 2 [3] 4   Go Up
 

Page created in 0.033 seconds with 20 queries.