Getting the link for a full image via ShareX

So I've been using ShareX's custom uploader and using zenphoto to manage screenshots. I had recently wanted to watermark said screenshots so I decided to change the PHP file ShareX uses on the webserver, to copy the url zenphoto generates with the watermark.

Ex.
https://aeswere.ca/gallery/cache/ShareX/qaurvwt8lb_FULL_Logo.png : this is the full image link w/ watermark, as provided by the webserver/zenphoto itself.

ShareX will generate me a link exactly the same as that, minus the characters between the forward slash and underscore after the album name, ShareX.

But when using said link via browser, the url is then rewritten to something like:

https://aeswere.ca/gallery/cache/ShareX/qaurvwt8lb_1920_Logo_FULL.png

and the watermarks' transparency is turned to dark grey.

Tags:

Comments

  • acrylian Administrator, Developer
    edited December 2020

    I have no idea what ShareX is or what it does. Why not use Zenphoto's own uploaders?

    https://aeswere.ca/gallery/cache/ShareX/qaurvwt8lb_FULL_Logo.png : this is the full image link w/ watermark, as provided by the webserver/zenphoto itself.

    That's actually not the full image link but the link from the cache which might the same as full image (depending if the size requested is the same as the full image or

    The full image link would be https://aeswere.ca/gallery/albums/ShareX/qaurvwt8lb_FULL_Logo.png if your install is within the "gallery" subfolder of your domain and the album is named "ShareX".

    https://aeswere.ca/gallery/cache/ShareX/qaurvwt8lb_1920_Logo_FULL.png is the correct url for a cached image as teh 1290 indicates the size it was resized to. If the full image is also copied to the cache depends on some image options which I naturally don't know.

    In any case the "cache" folder is the wrong folder to upload to if you want to use Zenphoto properly as it is for resized images only. You have to upload full images to the "albums" folder.

    Also see here: https://www.zenphoto.org/news/caching/
    Btw, Zenphoto also can watermark images.

  • Aeswere Member
    edited December 2020

    small edit: missed your question at the beginning: ShareX is more or less a screenshot application, which can give me the option to upload the screenshot taken, and a ton of other things, I'm fairly certain zenphoto cannot do that, and I would rather not have to upload every screenshot I take as I would be using Imgur if I wanted to.

    https://getsharex.com/ - You should be able to see/learn about it here, and/or try it yourself. But in simple terms, it lets me upload my images directly to my webserver/zenphoto, as it's ustilizing a php file.

    I actually made that mistake of uploading to the cache folder when testing, but altered the php file to upload to the same location (being albums/sharex) and had it return a link with cache/sharex/whatever.

    But the problem with the resized url version the watermark isn't png, and seems to be jpg or something, as the watermark has no transparency.

    Ex.
    https://aeswere.ca/gallery/cache/ShareX/r4ulrpzk76_FULL_Logo.png - Link ShareX copies to my clipboard, turns into:
    https://aeswere.ca/gallery/cache/ShareX/r4ulrpzk76_1920_Logo_FULL.png

    https://aeswere.ca/gallery/cache/ShareX/r4ulrpzk76_FULL_Logo.png - Proper link you get when going though zenphoto/the gallery.

    $domain_url.$cachedir.$filename.$watermark.'.'.$fileType;
    being the link that gets returned to me/my clipboard, altered from

    $domain_url.$sharexdir.$filename.'.'.$fileType;

    and assuming
    if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $sharexdir.$filename.'.'.$fileType))
    is the line that actually moves the file to the correct directory, being the album iteself.

    As for the why I wanted to use the cache link, was because I'd like the watermark to exist to the url I share. aka a direct link w/ watermark, instead of it not having it.

    Edit after typing up everything above:
    I changed cache to albums to see if it would work and it doesn't, because the image has to be cached (afaik) for the watermark to work.

    Another example:
    https://aeswere.ca/gallery/albums/ShareX/xwgtrtowcq_FULL_Logo.png

    this link does not work.

    but https://aeswere.ca/gallery/cache/ShareX/xwgtrtowcq_FULL_Logo.png
    does although redirected to the resized url.

  • acrylian Administrator, Developer
    edited December 2020

    Sorry, I really have no time to test ShareX or any other services for your specific problem.

    You can direclty upload to a folder within the "albums" folder via FTP or such a third party script. Zenphoto will on discovery (see the link I posted above which explains it) generate resized images as requested.. Those cached files follow strict naming conventions and you normally have not to deal with them or the direct URLs. There are available functions for getting image urls that also handle in case a cached file has been deleted meanwhile. See on docs.zenphoto.org for example.

    Regardinghttps://aeswere.ca/gallery/albums/ShareX/… you did check if that path and folder actually exists? How is the actual image uploaded named? Since your site is protected I naturally cannot take a look. Or it's some permissions issue.

    Depending on the options Zenphoto may convert pngs to jpeg but default is normally to keep png and gif as such. And it would change the suffix for the cache

  • The location the images go to does exist.

    How would I get myself the full/direct link to the image with the watermark that the image processor adds to the image? via php/script, if that's possible? As it seems my way of doing it doesn't seem to work like I thought.

    And I have my site protected as it's used mainly for my own image hosting, instead of having to take time to upload to another site to share a link of an image. The gallery was mainly just so I could easily browse if I needed/wanted an older screenshot I had taken, instead of having to download them and view them manually and whatnot.

  • acrylian Administrator, Developer

    The location the images go to does exist.

    If the URL to the full image does exists but does not work I have no idea. That's a real static path that does not change after upload. Except the mentioned permissions, some htaccess procetion agains direct linking (which you surely would know about) or similar.

    How would I get myself the full/direct link to the image with the watermark that the image processor adds to the image? via php/script, if that's possible? As it seems my way of doing it doesn't seem to work like I thought.

    Within Zenphoto (theme) context there are functions available for all this but naturally not with an outside script easily. You can try the "plugin way" mentioned here but I have tried that in ages and there is no guarantee it will always work in the future. https://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms/
    How the cached image is named depends on its size.

    The easiest is perhaps to get the image page link instead. The would be https://aeswere.ca/gallery/ShareX/filenname.suffix.rewritesuffix.

Sign In or Register to comment.