View Full Version : Need help creating a plugin
I have been trying to create this plugin. I already have my id wich is 119.
I have been trying to use code from the standard subdreamer gallery, but I'm a total newb at php. I suppose it's simple what I want to do but I can't get it to work.
Here's the basic idea:
p119_flash_gallery
....install.php (maybe just .jpg or .jpeg to make it simple for now).
......a) Check for duplicate filenames. I would like to keep the existing file name, but if it can be changed to the ID number in the DB and kept that way when uploaded into the images folder that's ok.
2. Beable to delete images. Additionally when a image is deleted the thumbnail would need to be deleted as well. The thumbnail carries the same name as the original file except it's in the /images/thumbs folder.
That's pretty much it. I'm really embarresed to show what I have so far, it's just a hacked up version of the image gallery. :(
I will post my progress if anyone wants to give me a hand, your help will be much appreciated.
Tomatos
08-28-2005, 11:01 PM
The Link to us plugin that I created has some of the features you need. Have a look at it and see if you can use some of the code in it.
So I have to pay for your plugin?
thomas
08-31-2005, 09:19 AM
Originally posted by IGGY@Aug 31 2005, 03:55 PM
So I have to pay for your plugin?
945
hmm... the plugin is also available on this site for free.... or hang on...
its disapeared??
whats going on tomatos? unless my mind somehow went blank and i have just made a fool out of myself? or the plugins were available on thsi site earlier on in its birth?
Tomatos
08-31-2005, 10:33 AM
Originally posted by thomas@Aug 31 2005, 02:19 AM
hmm... the plugin is also available on this site for free.... or hang on...
its disapeared??
whats going on tomatos? unless my mind somehow went blank and i have just made a fool out of myself? or the plugins were available on thsi site earlier on in its birth?
949
It's free, but you have to be registered. Free to register also.
Sorry for the confusion.
TD
vista
08-31-2005, 10:39 AM
The Link to Us plugin is free.
Sweet, I just downloaded it. I'll have a look at it, hopefully I can ge this thing done soon.
Terminator1138
08-31-2005, 06:22 PM
Did I miss something ??
IGGY you stated you need a flash Image gallery help, but then there was the mention of link to us plugin?
A bit confused on what you need then?
abcohen
08-31-2005, 06:54 PM
he needs help coding the flash gallery :P so TD was saying that some of the code from the link to us plugin would help him out...
Ok, I've almost got Flash Gallery v0.1 working :P . Thanks to Tomato for most of the SD code ;)
Well it works I just need to figure out how to delete thumbnail images form the thumbnail folder when you delete the origninal image from the admin panel.
function ApplyChanges()
{
*global $DB, $refreshpage;
* *echo'<b>APPLYING</b>';
* $deletemessageid = $_POST['del_id'];
* * * *for($i = 0; $i < count($deletemessageid); $i++)
*{
* *$DB->query("DELETE FROM " . TABLE_PREFIX . "p667_linktous WHERE pic_id = '" .$deletemessageid[$i]."'");
*}
PrintRedirect($refreshpage, 1);
}
That's the code from Tomato, so would I have to give the thumb an ID so it can be deleted too?
I just noticed that the origninal uploaded pic does not get deleted.
So I need to work on getting both files deleted (original and thumb).
All done. I'll polish the last little details and it should be ready for testing as Alpha or beta.
Tomatos
09-01-2005, 08:02 PM
I wouldn't mind having that code to delete the file myself.... Would you share?
TD
Sure here is the code you would need for your plugin.
Thanks verymuch for the help, BTW!!
function ApplyChanges()
{
*global $DB;
*global $refreshpage;
*// get post vars
*$imageid = $_POST['del_id'];
*for($i = 0; $i < count($imageid); $i++)
*{
* *$getfilename = $DB->query_first("SELECT file_name FROM " . TABLE_PREFIX . "p667_linktous WHERE image_id = '".$imageid[$i]."'");
* *$filename * *= $getfilename['file_name'];
* *$original * * = dirname(__FILE__) . '/images/' * *. $filename;
* *// delete image
* *$DB->query("DELETE FROM " . TABLE_PREFIX . "p667_linktous WHERE image_id = '".$imageid[$i]."'");
* *@unlink($original);
*}
*PrintRedirect($refreshpage, 1);
}
Tomatos
09-01-2005, 10:56 PM
Sweet. Thanks...
TD
I have version 1.0 running on my site now. I will get it up for everyone by the end of this weekend.
http://www.iggycorp.com/home/photography
comments?
abcohen
09-04-2005, 04:51 PM
looks good... would be sweet to add some flash function for comments and describtion fields. (but thats only if you have access to modify the flash source) but it looks sweet.. and its a very impressive skin you have running over there...
Thanks! I think it's the best skin I have so far.
I just made an update to it and built it using <div>'s instead of frames. The skin is Valid HTML 4.01 Transitional, but I couldn't get the site to be because some of the code that subdreamer produces does not validate.
I only have a small problem with the Logo in IE.
EDIT: The plugin is available for download.
http://www.subdreamer.org/forum/index.php?showtopic=171
All right guys I'm working on an upgrade on this plugin. I need help with the upgrade script in the install.php file. Anyone want to point me in the right direction?
thomas
10-13-2005, 03:29 AM
<div class='quotetop'>QUOTE(IGGY @ Oct 13 2005, 01:08 PM) 1690</div>
All right guys I'm working on an upgrade on this plugin. I need help with the upgrade script in the install.php file. Anyone want to point me in the right direction?
[/b]
we sure can point you in the right direction - a awsome plugin made by a awsome contributor....
If this dosent make any sence below... im happy to explain it more in detail, pm me or such....
-------------
Save and copy the current version into another directory, so that you dont loose what you had previously.
Open up your install.php file
Find the current version number which most likely would look like this..
$version = '1.0';
Replace with the new version number - ur choice
$version = '1.1';
Next..
In your actual install function with the sql bla bla bla, you should add a update function, so it looks a bit like this..
if($installtype == 'install')
{
SQL ETC HERE
BLA BLA
// upgrade to 1.1
p117_Upgrade110();
}
Then add the update function
############### UPDATE FUNCTION #############
function p117_Upgrade110()
{
global $DB;
SQL AND PHRASES ETC ETC
}
Last, you need the update to work, so that it finds the previous version if installed, and updates the sql to reflect the new update....
// ############################## UPGRADE PLUGIN ###############################
if($installtype == 'upgrade')
{
// upgrade to 1.1
if($currentversion == '1.0')
{
p117_Upgrade110();
UpdatePluginVersion($uniqueid, '1.1');
$currentversion = '1.1;
}
}
Hope this helps. Otherwise, just check out one of my plugins - the contact list manager, and have a look at the install code.
thanks. thomas
W00t!!
Guys I hit a big milestone. I finally got the plugin to be cloneable. I thought this would be impossible, but it's works!!
Now I need to figure out how to make the upgrade script and I release the update.
thomas
10-17-2005, 06:46 AM
<div class='quotetop'>QUOTE(IGGY @ Oct 17 2005, 04:40 PM) 1733</div>
W00t!!
Guys I hit a big milestone. I finally got the plugin to be cloneable. I thought this would be impossible, but it's works!!
Now I need to figure out how to make the upgrade script and I release the update.
[/b]
Iggy, as i said in the last post, if you hit troubles pm me.
I can help with the update.php page
Cool, thanks! It's getting late so I'll look into it tomorrow.
I got it to work. Once I fix the DL manager on my site I'll put it up.
thomas
10-17-2005, 11:12 PM
awsome...see creating plugins isnt that hard.
just takes a while
:D
Ok I think I'm done, just a bit more testing an I will release shortly.
So the gallery is now cloneable, has a scrollbar, and settings can be changed in ACP.
Teaser:
http://home.iggycorp.com/images/flscreenshot.gif
d_source
10-19-2005, 08:27 AM
<div class='quotetop'>QUOTE(IGGY @ Oct 18 2005, 11:05 PM) 1756</div>
Ok I think I'm done, just a bit more testing an I will release shortly.
So the gallery is now cloneable, has a scrollbar, and settings can be changed in ACP.
Teaser:
[/b]
Looks great :rolleyes:
abcohen
10-19-2005, 10:40 AM
it does look great.
Version 1.1 is available for download:
http://home.iggycorp.com/downloads/p13_sec.../2/p13_fileid/2 (http://home.iggycorp.com/downloads/p13_sectionid/2/p13_fileid/2)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.