git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@915 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-07-21 11:14:17 +00:00
parent 9044abdfc2
commit 4b666a8f1a
5 changed files with 32 additions and 10 deletions

View File

@ -14,10 +14,7 @@ class FlashFileHandler extends Extension {
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
$hash = $event->hash;
$ha = substr($hash, 0, 2);
if(!copy($event->tmpname, "images/$ha/$hash")) {
$event->veto("Flash Handler failed to move file from uploads to archive");
return;
}
if(!move_upload_to_archive($event)) return;
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
if(is_null($image)) {

24
contrib/piclens/main.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/**
* Name: PicLens Button
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Adds a link to piclensify the gallery
*/
class PicLens extends Extension {
public function receive_event($event) {
if(is_a($event, 'PageRequestEvent')) {
$event->page->add_header("<script type=\"text/javascript\" src=\"http://lite.piclens.com/current/piclens.js\"></script>");
}
if(is_a($event, 'PostListBuildingEvent')) {
$foo='
<a href="javascript:PicLensLite.start();">Start Slideshow
<img src="http://lite.piclens.com/images/PicLensButton.png"
alt="PicLens" width="16" height="12" border="0"
align="absmiddle"></a>';
$event->page->add_block(new Block("PicLens", $foo, "left", 20));
}
}
}
add_event_listener(new PicLens());
?>

View File

@ -50,6 +50,8 @@ class RSS_Images extends Extension {
$link = make_link("post/view/{$image->id}");
$tags = $image->get_tag_list();
$owner = $image->get_owner();
$thumb_url = $image->get_thumb_link();
$image_url = $image->get_image_link();
$posted = strftime("%a, %d %b %Y %T %Z", $image->posted_timestamp);
$content = html_escape(
"<p>" . Themelet::build_thumb_html($image) . "</p>" .
@ -63,6 +65,8 @@ class RSS_Images extends Extension {
<guid isPermaLink=\"true\">$link</guid>
<pubDate>$posted</pubDate>
<description>$content</description>
<media:thumbnail url=\"$thumb_url\"/>
<media:content url=\"$image_url\"/>
</item>
";
}
@ -71,7 +75,7 @@ class RSS_Images extends Extension {
$base_href = $config->get_string('base_href');
$version = VERSION;
$xml = "<"."?xml version=\"1.0\" encoding=\"utf-8\" ?".">
<rss version=\"2.0\">
<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\">
<channel>
<title>$title</title>
<description>The latest uploads to the image board</description>

View File

@ -255,7 +255,7 @@ function get_base_href() {
function move_upload_to_archive($event) {
$hash = $event->hash;
$ha = substr($hash, 0, 2);
if(!copy($event->tmpname, "images/$ha/$hash")) {
if(!@copy($event->tmpname, "images/$ha/$hash")) {
$event->veto("Failed to copy file from uploads ({$event->tmpname}) to archive (images/$ha/$hash)");
return false;
}

View File

@ -14,10 +14,7 @@ class PixelFileHandler extends Extension {
if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) {
$hash = $event->hash;
$ha = substr($hash, 0, 2);
if(!copy($event->tmpname, "images/$ha/$hash")) {
$event->veto("Pixel Handler failed to copy file from uploads ({$event->tmpname}) to archive (images/$ha/$hash)");
return;
}
if(!move_upload_to_archive($event)) return;
send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
if(is_null($image)) {