Module: preformatted URLs (attachment + screenies, yay)

shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sat, 2005-08-27 20:07

Thanks marco, actually on my gallery2 when I use the Link to the page of the image in bbcode it goes to my resized version. I think there is something wrong with the ItemUrls code when it tries to get the resized ids. I really don't have time to mess with it. Sorry.

 
F1_Fan

Joined: 2005-08-28
Posts: 2
Posted: Sun, 2005-08-28 18:56

Could someone please describe (or post a screenshot) where the "get item URLs" option is? I think I've got the module installed correctly on G2 RC1 (the URLs in the address bar have changed) but using the default G2 theme I can't see where the clickable "get item URLs" is.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-08-28 19:06

One is the admin page picture and the other is how you access it the actual urls.

 
F1_Fan

Joined: 2005-08-28
Posts: 2
Posted: Sun, 2005-08-28 22:37

Ah, thanks. I see neither of those options so I guess I don't have the module installed correctly.

<edit> OK, I got it... thanks for your screenshot. Two things...

1) I got confused by the existing URL Rewrite option

2) When I looked at the Module admin page more closely I realized that I had to install your 0.8.4 version because the 0.8.3 version wasn't working.

 
marco@mydub

Joined: 2004-01-07
Posts: 48
Posted: Mon, 2005-08-29 13:41
shocksll wrote:
Thanks marco, actually on my gallery2 when I use the Link to the page of the image in bbcode it goes to my resized version. I think there is something wrong with the ItemUrls code when it tries to get the resized ids. I really don't have time to mess with it. Sorry.

Steve,

What image sizes do you have?ho w many different resized images does your gallery offer?
I wonder if that is what the issue is ... that it will give you the largest resized image automatically. i have 3 resized version, and the largest resize is actually in there twice because i have a max image size .. and its set to the largest resize also (1920x1920) .. i wonder if that is what it is. i will let you know when i get a chance to play with it later today.

--marco

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Mon, 2005-08-29 14:12

Yea, I only have one resized image size which is 640x480.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Sun, 2005-09-04 08:56

Would You pls help me where to modify the code to give access as default to ALL users to the geturls link?

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-09-04 12:16

it's in the permissions. No code modification nessessary.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Sun, 2005-09-04 12:26
shocksll wrote:
it's in the permissions. No code modification nessessary.

uhm, i would like it to be the default for _all_ new and old albums too, automatically.
giving the right permission by hand to all albums is not an option
(lots of users, lots of albums)
?

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-09-04 12:30

most likely, if you set it on the root album, it will be inherited to all the other albums. Depends on your settings though. Try it out. Just give the group Everybody permissions to view formatted urls on your root album.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Sun, 2005-09-04 12:52
shocksll wrote:
most likely, if you set it on the root album, it will be inherited to all the other albums. Depends on your settings though. Try it out. Just give the group Everybody permissions to view formatted urls on your root album.

ehm, You are right. Sorry :)

Another question/idea: wouldn't it be nice if these url's could be printed out for albums too?
used in some cases..

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-09-04 13:00

the album urls are easy, right click on the album highlight and click copy shortcut (if in IE) or copy link location (firefox).

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Sun, 2005-09-04 13:02
shocksll wrote:
the album urls are easy, right click on the album highlight and click copy shortcut (if in IE) or copy link location (firefox).

;)
easy for us, not that easy for (my) users ;)
i'm gonna make buttons(click=copy) for them, at the end of every row on urldisplaying page :)

but thanks..now it's more important for me to find a way to display resized images instead of full sized ones..
(anybody with solution?)

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-09-04 13:09

In the permissions you can not give people the ability to view full sized images.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Sun, 2005-09-04 13:14
shocksll wrote:
In the permissions you can not give people the ability to view full sized images.

? in which permissions?

in that case what is that on the permission page:
Group name Permission
Everybody [core] View all versions
and
[core] View original version

?
one of these should be the "full sized images" i guess :)

tell me if i'm wrong
(g2 rc2)

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-09-04 15:41

Just try it and see what happens. I would say just give everybody the ability to view resized versions and view item.

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-06 21:11

shocksll: what version were you working w/ when you added yer code to rev. 0.84?

i don't see the javascript links to the right of the input text areas for IE users to quickly copy the link to their clipboard.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-09-06 21:26

I think it was either the version from page 1 labeled 0.8.3 (but the module.inc said 0.8.2) or the one from the post http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=159059#159059. I downloaded them both, in the module.inc they both said 0.8.2. I don't remember which one I used. Is there a better place to find the latest and greatest version?

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-06 21:29

hrm.. u know what? i just dl'ed all of them... and it appears it never made it into a revision. just a post on here that you'd have to override a file.

i thought Kirill was gonna work it into 0.8.3 (which, as you stated, shows up as a 0.8.2 revision in the modules section) and i think Kirill intended too as well from his post. but looks like it never made it!

ok - i'll take yer 0.8.4 and add it into it, bundle it up, make it 0.8.5, heh!

think i might add a couple features too, so it might take a couple days...

thx for the quick reply shocksll! :)

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-09-06 22:14

No prob, I'm glad we could get the confusion worked out. If you get the opportunity, there are two things that I know that need to get worked out.
1. Factor the duplicate code in getitems.inc and callbacks.inc into a class
2. The Resize ID doesn't seem to work

If you don't have the time to do those things then no prob. Thanks.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Fri, 2005-09-09 01:28
shocksll wrote:
No prob, I'm glad we could get the confusion worked out. If you get the opportunity, there are two things that I know that need to get worked out.
1. Factor the duplicate code in getitems.inc and callbacks.inc into a class
2. The Resize ID doesn't seem to work

If you don't have the time to do those things then no prob. Thanks.

2. the problem with that resizeid goes into 0 nothing more, as far as i've seen the code, it caused by the geturlsomething.inc not going into the cycle, where resizeid's would be filled up.
I managed to fill it up via disabling some if check statement, and tadam, the good url appeared, and worked.

(and i'm quite stupid that deleted that installation, now i have to find the way again..gonna post it after)

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Fri, 2005-09-09 01:30
whodah wrote:
ok - i'll take yer 0.8.4 and add it into it, bundle it up, make it 0.8.5, heh!
think i might add a couple features too, so it might take a couple days...

thx for the quick reply shocksll! :)

niiiiice
pls keep us fresh with some posting, i'm in some problem with those (veryverysimple) javascript/buttons, just dunno why.. smarty makes me crazy ;>

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Fri, 2005-09-09 01:42
joe7rocks wrote:
2. the problem with that resizeid goes into 0 nothing more, as far as i've seen the code, it caused by the geturlsomething.inc not going into the cycle, where resizeid's would be filled up.

the problematic part:

if(!$hasIt){
                /* We'll be using this array in the ItemGetURLs.tpl template */
                $error['cantviewsource'] = 'true';

                /* Because an anonymous user can't access the source image, we'l
                list ($ret, $resizesTable) = GalleryCoreApi::fetchResizesByItemI
                if ($ret->isError()) {
                    return array($ret->wrap(__FILE__, __LINE__), null);
                }

                /* I'm a n00b and use this method to loop over the resizes. Seem
                foreach ($resizesTable as $resizes) {
                    foreach ($resizes as $resize) {
                        $resizeid = $resize->getId();
                    }
                }

      }

If Ya comment the first and the last line $resizeid simply gets filled up with the right number.._in the cases_ where there is really a resized version..
something bugging in here (or outta)..

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Fri, 2005-09-09 15:23

somewhere on the boards, i'll have to seek it out, valiant mentioned that there is a 'doesthumbexist' call of some sort. (that's not the exact name, just a quick post as i'm out of time atm to search for it!)

that'll probably be the correct way of fixing it.

 
joe7rocks
joe7rocks's picture

Joined: 2004-10-07
Posts: 560
Posted: Fri, 2005-09-09 16:20

I have "some" problems with the javascript buttons..
I have _no_ idea why this not working from smarty .tpl, but it's working for me on other .php pages..so any suggestion? :O
I try to use this : http://pastebin.com/358950
(it would copy text to the clipboard for IE users)

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-13 17:55

this is the part that i'm hung up on atm...

this prevents the resized ID from getting set. in particular, if i remove the first if statement:
if(!$hasIt) {

then that resized ID var gets set and we can go on our merry way.

any ideas why this isn't working even for the user 'Site Admin'?

	/* We're going to be using the status of these permission checks to determine what kind of URLs to generate */
	list ($ret, $hasIt) =
                       GalleryCoreApi::hasPermission($itemId,
                                                     array(),
                                                     array(3),
                                                     array('core.viewSource'));
                   if ($ret->isError()) {
                       return array($ret->wrap(__FILE__, __LINE__), null);
                   }		
	
	if(!$hasIt) {
		/* We'll be using this array in the ItemGetURLs.tpl template */
		$error['cantviewsource'] = 'true'; 

		/* Because an anonymous user can't access the source image, we'll try using the resized versions instead. */
 	        list ($ret, $resizesTable) = GalleryCoreApi::fetchResizesByItemIds(array($itemId));
	        if ($ret->isError()) {
	            return array($ret->wrap(__FILE__, __LINE__), null);
	        }
	
		/* I'm a n00b and use this method to loop over the resizes. Seems to work okay. */
	        print_r($resizesTable);
					foreach ($resizesTable as $resizes) {
	            foreach ($resizes as $resize) {
	                $resizeid = $resize->getId();
        	    }
	        }

	}

	/* We now check if access to the resized versions is allowed at all */
	list ($ret, $hasIt) =
                       GalleryCoreApi::hasPermission($itemId,
                                                     array(),
                                                     array(3),
                                                     array('core.viewResizes'));
                   if ($ret->isError()) {
                       return array($ret->wrap(__FILE__, __LINE__), null);
                   }		
	
	if(!$hasIt) {
		$error['cantviewresizes'] = 'true';
	}
 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-13 18:20

this is the part that i'm hung up on atm...

this prevents the resized ID from getting set. in particular, if i remove the first if statement:
if(!$hasIt) {

then that resized ID var gets set and we can go on our merry way.

any ideas why this isn't working even for the user 'Site Admin'?

	/* We're going to be using the status of these permission checks to determine what kind of URLs to generate */
	list ($ret, $hasIt) =
                       GalleryCoreApi::hasPermission($itemId,
                                                     array(),
                                                     array(3),
                                                     array('core.viewSource'));
                   if ($ret->isError()) {
                       return array($ret->wrap(__FILE__, __LINE__), null);
                   }		
	
	if(!$hasIt) {
		/* We'll be using this array in the ItemGetURLs.tpl template */
		$error['cantviewsource'] = 'true'; 

		/* Because an anonymous user can't access the source image, we'll try using the resized versions instead. */
 	        list ($ret, $resizesTable) = GalleryCoreApi::fetchResizesByItemIds(array($itemId));
	        if ($ret->isError()) {
	            return array($ret->wrap(__FILE__, __LINE__), null);
	        }
	
		/* I'm a n00b and use this method to loop over the resizes. Seems to work okay. */
	        print_r($resizesTable);
					foreach ($resizesTable as $resizes) {
	            foreach ($resizes as $resize) {
	                $resizeid = $resize->getId();
        	    }
	        }

	}

	/* We now check if access to the resized versions is allowed at all */
	list ($ret, $hasIt) =
                       GalleryCoreApi::hasPermission($itemId,
                                                     array(),
                                                     array(3),
                                                     array('core.viewResizes'));
                   if ($ret->isError()) {
                       return array($ret->wrap(__FILE__, __LINE__), null);
                   }		
	
	if(!$hasIt) {
		$error['cantviewresizes'] = 'true';
	}
 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-13 18:46

hrm... nm that last post... i think i see what's going on! :)

should have 0.8.5 posted in a couple hours.

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-13 20:22

oooooook, 0.8.5!

compatible out-of-the-box w/ G2 RC2 'kthxbye' and G2 full. older revisions will require the core number changes.

things i've changed/added all based off the 0.8.4 release on this thread:

  • changed revision from 0.8.4 to 0.8.5
  • added IE quick-links that copies the formatted URL to your clipboard (to new functions below and the item id's at the bottom as well)
  • changed the term 'get item URLs' to 'Get item URLs' to match the case of the other G2 drop-down boxes and menus. (looking back, probably should have capitalized 'item' too, but it's already packaged, heh! maybe someone can catch that on the next rev...)
  • added HTML resized to full functionality. similar to the thumbnail functionality except the 'thumbnail' is the resized image and it links to the full image
  • added BBCode resized to full functionality. similar to the thumbnail functionality except the 'thumbnail' is the resized image and it links to the full image

i don't fully understand the permissions system i guess... i cannot get the resized stuff to show up unless i start messing w/ those 'if' statements no matter what i've tried w/ the permissions.

and those warnings that we can surpress about unauthenticated users not having access do come up for me. so if someone can tell me how or point me to some docs on what i need to do to allow permissions to access resized images, i'd greatly appreciate it! :)

ooooooook, so i swear there's no 'attachment' button on the new forums... heh!

http://boss.epconline.net/files/3/geturls-0.8.5.zip

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Tue, 2005-09-13 20:28

bah, sorry for so many posts in a row...

i forgot to add that the new html/bbcode resized to full only work if you can see the resized id on your 'get item urls'... i think... ha ha!

seriously: i coded them in the same way the other resized items are coded in. so if u couldn't see previous resized items, then these won't show up either.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-09-13 20:48

Thanks for the update!! I'll update the codex.

Steve Lineberry

 
rebel2k

Joined: 2002-10-18
Posts: 39
Posted: Fri, 2005-09-16 13:31

great module guys!!!!

keep goning on :)

 
pippin88

Joined: 2005-09-17
Posts: 23
Posted: Sat, 2005-09-17 15:37

Great Mod, very handy since the change in addresses with G2. I also used to use the .thumb stuff to have linked thumbnails.

However, (not sure how hard this would be), could you have an option to create a page with every image in the album with code for eg. a clickable thumbnail. That would make my forum image posting so much easier, as I could just select all the code on the page then paste it into a forum and have it all work.

Would be even better than the g1 system (which I currently think is easier than this - I just coded in the image names myself within a standard url)

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sat, 2005-09-17 15:44

You're welcome to modify the module yourself to fit your needs.

Steve Lineberry

 
pippin88

Joined: 2005-09-17
Posts: 23
Posted: Sun, 2005-09-18 01:39

I'd really like to, but I have absolutely no idea.

I'm guessing it wouldn't be as simple as changing getId to getId for all images or something.

 
pippin88

Joined: 2005-09-17
Posts: 23
Posted: Thu, 2005-09-22 06:43

Could anyone point me in the right direction?

I pressume I need to create a new item in the drop down menu, then have that call up a page with the code on it, but It has to somehow do it for every image.

 
Ozy

Joined: 2005-09-23
Posts: 1
Posted: Fri, 2005-09-23 19:22

When i install this on the G2 release, it complains of incompatible API's. Is this mod going to be updated for the release version? Sounds like a great mod.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Fri, 2005-09-23 20:51

Did you try 0.8.5??

Steve Lineberry

 
ZyreX

Joined: 2004-03-04
Posts: 43
Posted: Mon, 2005-09-26 18:27

I would like it to show the resized pics instead of the thumbnail, as in the 640x480 picture, and with a link to the fullsized..
Is that possible?

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Wed, 2005-09-28 00:52

It looks like when the forums were imported to this new board some of the characters didn't properly translate over so it is a mix of characters with ASCII.

Can someone repost how to get 0.8.3 to properly work with URL rewrite. The screenshots show that it can but after I have activated it, it appears that the URL links it creates are not short URLs using URL rewrite even though my gallery is.

 
bhill1429

Joined: 2005-05-04
Posts: 4
Posted: Wed, 2005-09-28 18:33
pippin88 wrote:
I'd really like to, but I have absolutely no idea.

I'm guessing it wouldn't be as simple as changing getId to getId for all images or something.

I would like to see this also I am a ASP novice guy my self and cant seem to get it work any help would be great

 
pippin88

Joined: 2005-09-17
Posts: 23
Posted: Thu, 2005-09-29 07:39
Shadow_Wolf wrote:
It looks like when the forums were imported to this new board some of the characters didn't properly translate over so it is a mix of characters with ASCII.

Can someone repost how to get 0.8.3 to properly work with URL rewrite. The screenshots show that it can but after I have activated it, it appears that the URL links it creates are not short URLs using URL rewrite even though my gallery is.

Just a guess, but have you tried 0.8.5?

 
lwclam
lwclam's picture

Joined: 2004-08-01
Posts: 19
Posted: Tue, 2005-10-04 01:38

I can't download the 0.8.5. :(
It said "500 Internal Server Error"

[img:86a3673f48]http://www.chuenhk.com/signature.jpg[/img:86a3673f48]

 
whodah
whodah's picture

Joined: 2003-05-17
Posts: 96
Posted: Sat, 2005-10-08 18:41

wow - good call...

i won't be able to get ahold of my buddy who is hosting the file until monday, but i'll get the link straightened out.

can't believe i don't have a copy myself, heh!

9 x G1
3 x G2

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sat, 2005-10-08 20:04

Here you go. I found it in my browser cache.

Steve Lineberry

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Sat, 2005-10-08 20:04

dup post

Steve Lineberry

 
pkx

Joined: 2003-01-27
Posts: 54
Posted: Wed, 2005-10-12 14:57

Question: I see from the screenshots (I have not tried the module yet myself), users have the option to view the pre-formatted URLs from drop-downs on the album page.

Is it possible to do this directly from the photo page itself? I've modified my gallery to put the photo URL in BBCode right under the picture ([img](g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`")[/img]); however, the variables for the image page URL and thumbnail don't appear to be available from the photo page. I tried pasting some of the code from this module page to confirm this... the URL comes up as main.php and the thumbnail comes up as "unknown."

Does anyone know of a way to pass the relevant variables over to the photo page?

Thanks!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-10-12 15:02

the module could be extended by adding a block to it.
then you could add the block to photo pages...

 
pkx

Joined: 2003-01-27
Posts: 54
Posted: Wed, 2005-10-12 15:11
valiant wrote:
the module could be extended by adding a block to it.
then you could add the block to photo pages...

Hm.. I wouldn't know the first thing about how to do that. :)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-10-12 15:20

that was rather a suggestion for the authors of the module :)