Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 25    Views: 91

Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
09/19/13 01:23 PM (12 years ago)

Thumb Viewer Plugin Suggestion

It would be an awesome feature if we could have an "Image Directory" setting in the plugin screen. This would let us just enter a URL to a directory full of images, and the album would display thumbnails of all images in that directory automatically. There's probably a way with the screen data URL, but I don't know JSON
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
09/19/13 04:04 PM (12 years ago)
Hi Ninja, This is absolutely possible but you have to use a php script. David @buzztouch wrote this a while ago and I modified this to work with The ThumbViewer Plugin. Download the script via this link: https://dl.dropboxusercontent.com/u/3427464/BTA_thumbViewer/Dir%20script/imgdir.txt Change the file name from .txt to .php So the filename is imgdir.php. On your server create a directory and fill it with images. let's say you've created this like this: http://www.yourdomain.com/myimages/ Upload this script into this directory (with images). Before you upload this open the script and look for this section: ///////////////////////////////////////////////////////////////// // SET THESE 2 VARIABLES TO YOUR NEEDS //The URL to prepend to images file names. Do not include the trailing slash (/) $urlToThisDirectory = "http://www.yourdomain.com/your_image_folder"; //writeable image directory. It's assumed that this script is in the same directory as the images. $imageDirPath = "."; ///////////////////////////////////////////////////////////////// Read this, change it to your needs, save and upload. Now use the dataURL and use this url: http://www.yourdomain.com/myimages/imgdir.php This should do the trick. Best Regards, Danny
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
09/19/13 05:12 PM (12 years ago)
Awesome! Once again it's Danny to the rescue! :) I'll give it a try in the morning. Thanks. PS: for the second variable, the writable image path, if the script is in the same directory, do I just leave the line the way it is, with the "."?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/19/13 05:37 PM (12 years ago)
$imageDirPath = "."; or $imageDirPath = "./"; Is a php way of saying 'the same directory as the file you're reading from'. Think DOS paths :) Cheers! -- Smug
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
09/19/13 05:48 PM (12 years ago)
Perfect, thanks Smug. I'll try implementing this tomorrow. I assume I need to delete all existing image references from each thumb viewer screen or it will duplicate them, correct? Also, I'm probably looking at a total of a couple hundred screens... Would it make sense to put the script one level higher in my directory and leave the URL the same, for copy and paste purposes, rather than uploading it to multiple directories? Or does the script REQUIRE it to be in the same directory as the images?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/19/13 06:01 PM (12 years ago)
Hmm. The script requires the resources to be where the script says they'll be. If your script resides in a directory called "MyScript" then: BT_ServerRootDirectory     |- MyOtherScriptDir           |-- OtherImagesDir     |- MyScriptDir           |-- ImagesDir $imageDirPath = "."; <-- is the same directory your script runs from $imageDirPath = "./"; <-- is the same directory your script runs from $imageDirPath = "/MyScriptDir"; <-- is the same directory your script runs from $imageDirPath = "./ImagesDir"; <-- looks in the subdirectory "ImagesDir", beneath "MyScriptDir" Here's an interesting one: $imageDirPath = "../MyOtherScriptDir/OtherImagesDir"; <-- looks in the "MyOtherScriptDir/OtherImagesDir" directory for the images, from the script that resides in "MyScriptDir". Cheers! -- Smug
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
09/19/13 11:55 PM (12 years ago)
Hi, Thanks Smug for checking in! The Thumbviewer Plugin doesn't have lazy loading images but loads all the images as one. That said: don't put too many images in one directory (experiment with this) otherwise you could run into memory issues and very long loading times which give a bad user experience. Keep this in mind! Enjoy! Best Regards, Danny
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
09/20/13 05:22 AM (12 years ago)
It shouldn't be too bad... Each directory will only have 10-20 images, each one being under 100k in size
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
09/22/13 06:19 AM (12 years ago)
I just realized the flaw in putting one copy of the script in a higher level directory and calling it from each instance... the script requires the image path, so I'll have to put a modified copy of the script in each image folder as originally instructed. No big deal, was just trying to simplify the process and not have 400 copies of the same script on my server, lol.
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
09/28/13 10:35 PM (12 years ago)
Just starting out with BuzzTouch, and started with the ThumbViewer. It worked great with some test images stored on BuzzTouch-Application file area. But I was hoping to pull in images from folders like you discussed. (I'm planning to have on DropBox or FlickR.) How would I match up Image Title and description for each pic? Had been thinking of having a utility (similar to csv2json-map-maker-tool) that reads xls with all of the info, but pulling all of the images in a directory would be soooo much easier. Probably a simple question, but just getting started... Thanks! Kevin
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/29/13 01:20 AM (12 years ago)
Not sure how much information can be pulled from the file itself, but you can create a PHP file that will gather a list of images in the directory and output whatever information into json compliant output. What you 'may' want to do is have a directory of images. Also in the directory, to accompany 'image01.png', you could put a text file with the description, 'image01.txt'. Then have the PHP file inventory available images, and if present, also include the description contained in the *.txt file for the image, and output this information as json to the app. Does that make sense? Cheers! -- Smug
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
09/29/13 01:41 AM (12 years ago)
Hi Kevin, I wouldn't use dropbox for this purpose because dropbox was designed as a harddrive that you can use to send lost of traffic to. If you still do this they may suspend your dropbox account. For the description and title: Title gets pulled from the image name with this script. Ofcourse if there is only an image file name there is no way to pull a description --> only the title and the image itself. you would need to alter the script to also read e.g. a .txt file with the same filename as the imagename. That would require that if you upload a new image you'd also need to upload a .txt file with the description Hope this helps. Best Regards, Danny
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
09/29/13 06:38 AM (12 years ago)
Thanks for the fast replies Smug and Danny! Description: OK makes sense using the file name as a title, and having a corresponding .txt file with the description. For example: 'Summer at Lake George.jpg' and 'Summer at Lake George.txt'. I like the idea of having the PHP include the description if available. If no description was available, would it be easier to have a .txt that just had a single space or possible to skip having a .txt for some pictures? Understanding and then ability to transform it into code right now are not at the same level ;) -Can someone post how the modified script would look that also grabs the .txt Thanks!! I'll get there soon. Storage: DropBox out. No problem using Flickr -right? Thanks again! PS- will start a new thread specific to ThumbView with a few questions about when thumbnails are generated and items updated. Will try looking at code first before asking away.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
09/29/13 08:31 AM (12 years ago)
just as a side note, if you ever want to use the same app for android, do not have spaces in your filenames. Filenames should start with a lower case letter. Filenames should use lower case letters and numerals only. Use only jpg or png as images. image01.png <-- good Image01.png <-- not good for android image 01.png <-- not good for android Cheers! -- Smug
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
09/29/13 09:16 AM (12 years ago)
Another side note: If you want to use flickr just construct the url like this: http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=YOUR_APIKEY&photoset_id=YOUR_PHOTOSET_ID&extras=original_format&format=json Where you should change YOUR_APIKEY and YOUR_PHOTOSET_ID with your own key and photoset. Best Regards, Danny
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
09/29/13 09:22 AM (12 years ago)
Thanks for the heads-up on Android file-name restrictions. So much for using the file-name for the title. Looks like I would need to build that into the txt file as well. 'summeratlakegeorge' doesn't work very well for a description. At least Android didn't go all the way back to eight letters ;)
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
09/29/13 09:24 AM (12 years ago)
Danny- Thanks will try out flickr with some samples.
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
10/01/13 05:50 PM (12 years ago)
OK had time to start back in tonight. But didn't get far.... I created an account on flickr, created a test set with four images. Then created an APIKEY and notedthe PHOTOSET_ID. After editing the PHP script with this info my question now is: The notes in the thread above assume that the php script is located with images. I don't see how the script would be uploaded onto flickr?? I guess the solution is to setup a domain with storage (for image folders and scripts). However since I don't have one was thinking about flickr. What am I missing? --------- As you probably guessed, I am learning as I go, and was taking the approach of implementing small examples of each of the Plug-ins that I thought would be main components of an app prior to actual design.
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
10/01/13 06:00 PM (12 years ago)
Hey buzz, The images don't HAVE to be in the same directory, but you will in fact need somewhere to host the php script... And if you had that, you would also have space to store the images as well. In your example though, there are two places to modify in the php script. One is where the image directory is located (in your example, the flicker URL), and the other is the location of the script itself, which could be anywhere. I think you'll find though that if you have hosting somewhere to upload the php script, it will just be easier to upload your images to the same location and bypass flicker altogether. I use my web host, and in my images directory I make sub directories for each "album", and just upload a copy of the script to each one to make things quick and easy, with as little altering of the script each time as possible. I leave the script directory as ".", and only have to change the last folder name at the end of the URL in the image directory section of the script. Literally I change one word, upload and add my data URL and that's it. Hope that helps
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
10/01/13 06:40 PM (12 years ago)
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
10/01/13 06:45 PM (12 years ago)
Now let me remember what everyone recommended to pull in text descriptions via the PHP when I move images out of flickr... Any example of how to reference this?
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
10/01/13 11:16 PM (12 years ago)
HI NCBuzz, no!!!!!!!! If you want to use Flickr then you don't have to use this script. Just put the url in the dataURL of the/a thumbviewer screen in your controlpanel. That's it! Best Regards, Danny
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
10/02/13 06:51 AM (12 years ago)
ooops, sorry, my bad. Misunderstood. I don't use flicker, just the script on my own server, so I just assumed the flicker URL worked the same way. Sorry for the misdirection there NCBuzz. Still, the web hosted methods work as described.
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
10/02/13 05:17 PM (12 years ago)
I got what you both meant. My post last night was to say it does work fine when I use a URL similar to the second one shown in the Control Panel for that screen. - I am able to get all the images in a Set on flickr into a ThumbView screen :) I was just hoping that there could have been a way to get the Title and Description when pulling the image from flickr and passing it to the ThumbViewer- but I get that currently it would need to store my images on another service where I could put the PHP script in the folder with the images. Thanks again for the help.
 
Andrusito
Aspiring developer
Profile
Posts: 45
Reg: Jun 17, 2013
cordoba
450
like
08/08/14 08:46 AM (11 years ago)
Hello! Is there any way to replace the "share via email" by "share via..." and let the people decide how to share the images? It can show a list with all social networks the mobile has (facebook, twitter, whatsapp, google+, etc) Is that possible? Thanks, and great plugin btw.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
08/09/14 01:49 AM (11 years ago)
Hi Andrusito, In essence anything is possible but you have to make modifications to the code to add that functionality. In the meantime you can have a look at this (or google it: http://technet.weblineindia.com/mobile/twitter-and-facebook-sharing-in-ios-application-using-social-framework-in-ios-6/, if you are willing to make your hands dirty...:-), and I will keep it in mind for potential future updates. Best Regards, Danny
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.