Please convert tabs to spaces.
Chris
On Saturday 11 December 2004 1:07 pm, Jonathan Ernst wrote:
This patch let user click on the random screenshot displayed for an app so that he can see the whole gallery by version. The patch displays the name of the application in the gallery as well (even if we choose a particular gallery).
Screenshot gallery's screenshot: http://ernstfamily.ch/screenshot.png
File changed:
- appview.php
- screenshots.php
Hello,
I made a huge patch that (IMHO) cleans up the code structure of the AppDB and as a side effect, fixes most remaining global vars bugs.
If this patch can be added tonight I'll then improve and fix the screenshot code (it works, but sometimes there are problems with backslashing the image content). I found better ways to store images in mysql but I think it would be even better to put it on the serveur in /data/screenshots/queued/ they'll have an integer name (appDataQueue table's id) and the directory listing must not be readable.
I plan to change the way thumbnails are done. On the fly image generation can be very time consumming and if there are many users in the futures I think we could achieve much better performances using one-time thumbnails generation. As you can see I added in the config file width and height parameters for screenshots so that the algorithm will look like this:
do we have a thumbnail of the requested size for the requested imageId ? - if yes, serve the image - if no create a file /data/screenshots/thumbnails/$imageid_$width_ $height.$ext
This solves many problems: 1) less cpu demanding 2) if we change the file size in the config file, new thumbnails will be made upon request and someone can clean up the thumbnail directory using rm *_oldWidth_oldHeight.* 3) if two people submit two pictures with the same name (screenshot.png for example) it won't conflict as the id of the table is used 4) when a screenshot is accepted by an administrator or maintainer we just copy the file from /data/queued/screenshots and then delete it
If you do think it's clean like this, i'll work on it asap but then please ask the following to Jeremy if you see him (even if it breaks the screenshot function for some hours I think it's not a big issue):
1)create /data/queued/screenshots and /data/queued/screenshots/thumbnails directories (they have to be writable by the php process) 2)after making sure that no appdata is pending in the admin, issue the following sql requests:
drop table if exists appDataQueue; /* * links to screenshots and other stuff waiting to be accepted */ create table appDataQueue ( queueid int not null auto_increment, appId int not null, versionId int default 0, type enum('image', 'url'), description text, url varchar(255), userId int not null, submitTime timestamp, key(queueid), index(appId), index(versionId) );
Thanks a lot for everything, hope you like the patch altough it's huge (but it works and I couldn't make it much smaller as there are quite deep implications when moving things around)