Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
NoirCavalier
Topic Author
Posts: 17
Joined: 25 Jan 2015, 11:32

How to add downloads?

29 Jan 2015, 08:56

Hey Karl!
First off all i wanna thank u for the great work so far.
I really like the Software a lot, even it is a beta-Version.


Now to my question....

In my blog i want to add downloads, like Lightroom Presets or Photoshop Actions.

As i can not upload it with the internal uploader i have to upload it via ftp, what is no problem at all.
But if i wanna post a link to the file like:
Code
<a href="http://www.adomain.com/blog/Downloads/StartPreset/Start.lrtemplate" download="Start.lrtemplate">Here is the file</a>
or
Code
<a href="/blog/Downloads/StartPreset/Start.lrtemplate" download="Start.lrtemplate">Here is the file</a>
it always gives me an 404 error "Page not found". :shock:
Why "Page not found"? At first it should be "File not found" and at least it should download the file, as the link to the file is definitely correct. :lol:

So as i can´t get it to work internally, i decided to link the file using my Google Drive Account for now.
Any idea of how i can get work internally or is there something i did wrong?

Regrads, Marc
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: How to add downloads?

29 Jan 2015, 23:17

Hmm, this is most certainly related to the X3 ajax script hi-jacking URLs ... However, I could have sworn it should work if you use the absolute URL path (http), thus to force-bypass the X3 ajax mechanism. You can also try to add the class no-ajax to the link:
Code
<a href="/blog/Downloads/StartPreset/Start.lrtemplate" download="Start.lrtemplate" class=no-ajax>Here is the file</a>
If the above does not work, then I need to investigate, as it seems for some reason it is not respecting the URL, caused by something in the htaccess.

Is there a live link btw?
 
User avatar
sprocket
Experienced
Posts: 98
Joined: 18 Dec 2008, 19:40

Re: How to add downloads?

30 Jan 2015, 09:33

I apologize if I am hijacking this post, but I think. I have a situation that I think is similar to this one, involving urls.

My site consists of over 200 blog posts. Each of these post has 1-5 photos in the blog, so let's say 3 photos average.
The only way I have found for these photos to appear in the blog is to use an absolute url Example:
Code
http://mydomain.com/x3/content/3.blog/1.2010/1.0922/_pic1.jpg
I really don't want to use an absolute link to these pictures, what I really want is a relative link like
Code
./_pic1.jpg
since in this example, 0922 is the blog page and the photos are stored in that gallery. I want to do this, so I can move menu items around and change folder names without having to adjust some 600 absolute photo links.
The problems with ./_blogpic.jpg is that it is interpreted as
Code
http://mydomain.com/x3/content/blog/2010/0922/_pic1.jpg
and thus removes the "menu arranging numbers" and the link fails since it wants to see the actual folder names as they exists on the server and not their "beautified" names..

NoirCavalier - in your absolute link, if blog is a menu item and has a number in front of it, (or any other folder has a number in it, in that link) replace them with the actual folder names as they appear on your server, not the "beautified" names.
Example
Code
<a href="http://www.adomain.com/4.blog/Downloads/StartPreset/Start.lrtemplate" download="Start.lrtemplate">Here is the file</a>
So Karl, is there anyway to use relative links without them getting interpreted into something that fails? Personally, I think if people want crappy looking urls, then they should be allowed to have whatever they want. URLs on the web are getting uglier and uglier everyday. Even google after 15+ years of using just http://www.google.com, now jumps to https://www.google.com/?gws_rd=ssl. If there is a way to get rid of this url interpreter, I'd love to live without it. I realize your doing it to allow for the ordering of the menu items, but is there a better way? Of course, if the image links could be recognized without there "menu ording numbers", that would be just as good, since that's what the relative link generates.

P.S. I do LOVE it that simply adding an underscore in front of a filename hides it from the gallery. It's simple and effective.
Thanks for listening and for all the hard work - can't wait to see Beta 0.90
Joe
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: How to add downloads?

30 Jan 2015, 12:27

@Sprocket: Your question makes entirely sense, and is something we are putting thought into and have already (without yet yielding any benefits). My impression from the original poster, was that his links went to files in custom folders, but you could very well be right. If you are linking to files within folders in your X3 content, you need to make sure to use the actual physical path, and not the path in the URL, which is virtual and ultimately created by mod_rewrite:

URL
domain.com/some/folder/

Although you may have the above as URL, that is just a "rewritten" nice URL, and the actual folder PATH would look something like:
domain.com/content/2.some/4.folder/
Sprocket wrote:My site consists of over 200 blog posts. Each of these post has 1-5 photos in the blog, so let's say 3 photos average.
Just to be entirely clear, you are referring to blog posts added as X3 pages?
Sprocket wrote:The only way I have found for these photos to appear in the blog is to use an absolute url Example:
http://mydomain.com/x3/content/3.blog/1 ... /_pic1.jpg
Just for reference, you should be able to use "root-relative" URL's, which is normally the safest. For example:
Code
/content/3.blog/1.2010/1.0922/_pic1.jpg
As for the "URL interpreter", there are a few reasons why we use mod_rewrite to create pretty URLs that are not identical to the physical folder path. One is the numbering sorting mechanism of course, which allows us to sort folders manually, without having to resort to saving the sort into config data files. Also, it allows us to bypass the "content" folder, which is just there to contain your content. Furthermore, it allows us to show/hide folder, or make them inaccessible, and all this while keeping the URL slug as pretty as possible for the sake of both humans and SEO.
Sprocket wrote:but is there a better way?
Yes. I entirely agree with you, and as a user, you should not have to be guessing the physical path of a file that you want to link to. A general solution to this, would be using a "shortcode", for example:
Code
[path]image.jpg
X3 would then figure out the path to the current folder, and it would keep things updated if you change the slug of the page.

We could take it a step further, and just replace the path of files you link to without a path. For example:
Code
<img src=image.jpg >
... would get converted to ...
Code
<img src=content/1.real/2.path/image.jpg >
I would also like to ask, why and how exactly are you adding files to your blog pages? Are you linking to them with <a>, or are you embedding them with <img>? I am curious, because ultimately this sounds like a repetitive task that could perhaps be wrapped inside some kind of X3 feature ... For example [embed=file.jpg] or [link=file.jpg], which in addition to sorting out the path automatically, could give the benefit of adding wrapping html, styles and maybe functionality ...

X3 is primarily created as an app to get galleries automatically ... Can't you just use the gallery functions, or is it because you want to intertwine your blog text with certain images?
 
User avatar
sprocket
Experienced
Posts: 98
Joined: 18 Dec 2008, 19:40

Re: How to add downloads?

30 Jan 2015, 12:59

Just to be entirely clear, you are referring to blog posts added as X3 pages?
Yes - X3 Pages
Just for reference, you should be able to use "root-relative" URL's, which is normally the safest. For example:
yes - actually I use root relative, I was just feed off NoirCavalier's original post
I would also like to ask, why and how exactly are you adding files to your blog pages? Are you linking to them with <a>, or are you embedding them with <img>? I am curious, because ultimately this sounds like a repetitive task that could perhaps be wrapped inside some kind of X3 feature ... For example [embed=file.jpg] or [link=file.jpg], which in addition to sorting out the path automatically, could give the benefit of adding wrapping html, styles and maybe functionality ...

X3 is primarily created as an app to get galleries automatically ... Can't you just use the gallery functions, or is it because you want to intertwine your blog text with certain images?
Yes - I want to intertwine the blog with the text. I find it more pleasing and easier to read when there are some images interwoven.

I'm gonna PM you my website link so you can take a look for yourself - It's not ready for the www yet.
Joe
 
User avatar
NoirCavalier
Topic Author
Posts: 17
Joined: 25 Jan 2015, 11:32

Re: How to add downloads?

30 Jan 2015, 14:17

Thanks Karl.
mjau-mjau wrote: ...
You can also try to add the class no-ajax to the link:
Code
<a href="/blog/Downloads/StartPreset/Start.lrtemplate" download="Start.lrtemplate" class=no-ajax>Here is the file</a>
...
Adding the extension class=no-ajax worked for me. :D
mjau-mjau wrote:Is there a live link btw?
Yes it is, but nothing special yet. :wink:
Just have a look at http://www.marc-gauert.de
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: How to add downloads?

01 Feb 2015, 00:51

sprocket wrote:Yes - I want to intertwine the blog with the text. I find it more pleasing and easier to read when there are some images interwoven.
Just to conclude the PATH issue, this is definitely something we want to make much easier. Right now, I am thinking we could even replace all path src/url's that don't include a slash/, because that should indicate that they are clearly within the current folder:
Code
<a href=somefile.ext>text</a> --> <a href=content/1.folder/somefile.ext>text</a>
<img src=somefile.jpg> --> <img src=content/1.folder/somefile.jpg>
It would not interact with src/url's that have slash/ included, which would often be absolute, root-relative and other paths unrelated to the current folder.
NoirCavalier wrote:Adding the extension class=no-ajax worked for me. :D
I was trying to figure out why it didn't detect automatically that your link is not an internal X3 page, but I think I know: The extension ".lrtemplate" is a bit unusual, so it doesn't detect the page as an external file automatically like it would do for example for ".zip". I may need to look into this minor bug.