solved Unable to put a link containing the string ".jpg" in a comment.

lornawebber
@lornawebber
7 years ago
334 posts
When I try to paste a link into a comment, it all works fine, unless the link has the string ".jpg" in it. Then instead of the link, I get a little empty image box embedded.
https://pmp-art.com/tina-dumitru/gallery/197835/iris.jpg
I think it's the same for ".jpeg" but I can't find an example at the moment.
updated by @lornawebber: 08/08/17 09:37:28PM
lornawebber
@lornawebber
7 years ago
334 posts
I tried searching the Image gallery for 'jpeg' and it returns all images with the string 'image' in the filename e.g. https://pmp-art.com/carol-sutto/gallery/151752/image
brian
@brian
7 years ago
10,148 posts
This URL:

https://pmp-art.com/tina-dumitru/gallery/197835/iris.jpg

Is going to be seen as an IMAGE by the editor - I do not believe there is any way around this. That URL is not the correct URL to an image - and my guess is the user went back in and renamed the "title" of the image to the image name - does that sound correct?

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
7 years ago
10,148 posts
Have just tested this here and putting a filename for the gallery name doesn't work - the period is removed. How was this image created?

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
lornawebber
@lornawebber
7 years ago
334 posts
brian:
Have just tested this here and putting a filename for the gallery name doesn't work - the period is removed. How was this image created?

Thanks!

It's not a gallery name or an image title, Brian, it's an image filename.
The link I gave is the image page - the link created when the image file was uploaded to the gallery.

I suspect this only happens when the image hasn't been given a title by the user, so the uploaded filename remains part of the link to the image page.

It may be that the image file had two jpeg extensions on the user's computer/device. I have noticed that some people create images with two extensions - e.g. picture.jpg.jpg I suppose that in some image editors or scanners, you can save the image with a name that includes the extension and then it adds a .jpg extension of its own. When uploaded, the filename seems still to have a .jpg string in it.
I hope that helps, but I'll try to narrow it down a bit.
brian
@brian
7 years ago
10,148 posts
lornawebber:
It's not a gallery name or an image title, Brian, it's an image filename.

That is what I suspected, but I am not able to replicate it here. Let me know if you figure out how to make it happen and I can check it out.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 01/30/17 03:06:41PM
lornawebber
@lornawebber
7 years ago
334 posts
Hmm. I'm actually not sure now and will look further, Sorry, I thought I had identified it exactly.
I have another example of an image file uploaded by me some time ago. The link to the image page is https://pmp-art.com/lornas-likes/gallery/123583/Quick%20Draw%20Lorna%2012June15b%20s.jpg

The file I uploaded is attached and you can see the original image filename is part of that link. I did add an Image Title to that one, which is "Small Reflections", but the link includes the original filename with .jpg extension, and not the new title.

Some users have been complaining that they can't embed certain images and this may be a reason. The other cause was where the filename included an apostrophe, but you have already fixed that for us.
lornawebber
@lornawebber
7 years ago
334 posts
This is becoming more of a problem for us.
There seem to be a lot of images in our database that have ".jpeg" included in the link to the image page. It's not possible to embed these images in a comment, unless the ".jpg" part of the link is omitted.

Would it be possible to strip out the extension when the link is created, at the time the image is uploaded to the gallery?
brian
@brian
7 years ago
10,148 posts
I have tried everything on this end and am unable to replicate this. If I can figure out HOW this is happening on your site, then we can fix it.

You say "Some users have been complaining that they can't embed certain images and this may be a reason".

How are the image being embedded? Do you mean via the "Embed" popup that comes from clicking on the "Embed Local Media" button in the editor? Or are the users just pasting the URL into a comment?

Is this happening to NEW images that are uploaded or only existing old images that were uploading a while ago? I looked in your database at image id 123583 and it is all correct - none of the keys are named incorrectly.

I've tried both ways here and there are no issues, so I am trying to replicate this so I can see what might be causing it. I'm suspecting it is a template that has been customized that is not using the correct gallery functions, but there's a lot of templates in the Gallery module, so I just need to narrow down WHERE it is happening (i.e. only when using the embed function in the editor? Only in comments?) then I can try to find out why.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
lornawebber
@lornawebber
7 years ago
334 posts
@brian I'm sorry I've misled you with my last comment. I do apologise.
I meant to say (as in my opening comment on this forum) that we are trying to paste a link into a comment on a group discussion - not to 'embed' the image, but just 'include a link' to the image page in the comment text.

Typing text in the comment box and pasting a link to an image page: Where the link to the image page has the string ".jpg" in it, e.g. https://pmp-art.com/tina-dumitru/gallery/197835/iris.jpg the editor tries to embed the image itself, instead of just making it an active link. Instead of a link, you get a little 'broken' image box as shown in the screenshot on my opening comment.
brian
@brian
7 years ago
10,148 posts
Got it - so you're not clicking on the "Embed Local Media" button, just pasting the URL directly. That makes sense and now I remember why it's tricky - basically the editor (tinymce) is interpreting the link to the PAGE as an IMAGE URL. We're not going to change how the editor works, so let me see if changing the title so it removes the period or replaces it with an underscore or something would be the best route.

I'll check it out and let you know.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
7 years ago
10,148 posts
I believe I have a fix for this - needs to have some testing done before it makes it to the marketplace, but it should fix this up.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
7 years ago
10,148 posts
This should be fixed now in the latest Image Galleries module (1.8.8) update and let me know if that works. Basically the URL to the item detail page now has the extension removed. Note that you will start to see NEW URLs after the cache expires, but that should hopefully fix it up for you.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
lornawebber
@lornawebber
7 years ago
334 posts
That's great, thanks very much @brian .
I have just pasted the example link https://pmp-art.com/tina-dumitru/gallery/197835/iris.jpg into a group discussion comment, and it has appeared as an active link, as it should be. It certainly does help!
lornawebber
@lornawebber
7 years ago
334 posts
@brian Sorry, this has reverted. Again, I can't paste a link in a group discussion if it has ".jpg" at the end, without it being turned into a broken image link.
I have Image Galleries 1.8.8 installed.
michael
@michael
7 years ago
7,714 posts
From reading these
brian:..... That makes sense and now I remember why it's tricky - basically the editor (tinymce) is interpreting the link to the PAGE as an IMAGE URL. We're not going to change how the editor works, so let me see if changing the title so it removes the period or replaces it with an underscore or something would be the best route......

brian:....This should be fixed now in the latest Image Galleries module (1.8.8) update and let me know if that works. Basically the URL to the item detail page now has the extension removed.....

I think what brian is saying is that any image gallery urls that used to contain the .jpg now dont contain that. So the urls for pages in the gallery that were
site.com/profile/gallery/2/the-image-name.jpg

now are
site.com/profile/gallery/2/the-image-name-jpg

so when they are put into tinymce they dont register to the editor as an image url.

If you are pasting in something that ends in .jpg into the editor, thats still going to be treated as it ever was, but there should be no jamroom urls ending in .jpg that are not actual images.
lornawebber
@lornawebber
7 years ago
334 posts
@michael "I think what brian is saying is that any image gallery urls that used to contain the .jpg now dont contain that."

Some images do still have a ".jpg" in the link to the image page. For example this one I used in the example: https://pmp-art.com/tina-dumitru/gallery/197835/iris.jpg, and when I copy the link and paste it into a comment, I get the broken image symbol. If I post the comment, it appears as the text iris.jpg

This other image was uploaded to the gallery yesterday...
https://pmp-art.com/tam-tam/gallery/209201/006%20-%20Copy.JPG
I have tried pasting that link into a comment today and it works OK, but possibly because in this case, the hyphen is converted to %20-%20 ?

So can old images still have the .jpg in the link to the image page? Does the system convert .JPG and .jpeg as well as .jpg to a hyphen instead of a period?
Sorry to be dense.
michael
@michael
7 years ago
7,714 posts
As I understand the update.
* Nothing was done to the editor
This means that if the editor did something special with .jpg urls, then that will still happen.

I believe the update was to change the way jamroom wrote urls. So I would expect that any new urls going forward would not have the issue and that any existing items would be fixed if they were updated.

not dense to ask questions. I don't have a complete picture of how to setup to test the scenario so my info may be wrong. Hope im not confusing the situation.
michael
@michael
7 years ago
7,714 posts
For me on my system, when I paste a link in it doesn't get converted to an image, it stays as the link.

--edit--
scratch that, if i copy from the address bar, it does try to convert it to an image.

.jpg should only be the extension for images, so best not to use it in URL's for gallery pages.
updated by @michael: 05/08/17 03:19:28AM
lornawebber
@lornawebber
7 years ago
334 posts
Aah. I think I've just found the issue with this.
If I look at the thumbnail gallery images on a member's profile page, the links given still contain the ".jpg" strings, so if I right-click on one and get the image link from there, it will still contain a ".jpg" and I won't be able to paste the link successfully in a comment.
See screenshot - the link given for the image at the green arrow is https://pmp-art.com/tina-dumitru/gallery/208046/red%20and%20green.JPG.jpg
If I go to the gallery first and then get the link, I get https://pmp-art.com/tina-dumitru/gallery/208046/red-and-green-colours-of-the-month
michael
@michael
7 years ago
7,714 posts
The point of interest is where is that page linked to FROM.

Because this
https://pmp-art.com/tina-dumitru/gallery/208046/red%20and%20green.JPG.jpg
is the same as this
https://pmp-art.com/tina-dumitru/gallery/208046/red-and-green
and the same as this
https://pmp-art.com/tina-dumitru/gallery/208046/any-thing-you-want-to-write-here

So wherever its being linked to from that has the issue.
brian
@brian
7 years ago
10,148 posts
None of the image detail URLs should have any extension any longer - the entire extension is removed. If you don't see that, then it means you're likely looking at old URLs that were embedded before the change I put in place.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
lornawebber
@lornawebber
7 years ago
334 posts
Thanks for looking at this.
I do understand that only the part of the link up to and including the gallery image number, is relevant in identifying the image page.

I'm sorry, I don't understand why a thumbnail in the 'latest images' on the profile page should return (be associated with) a different url from the same image when seen as a thumbnail in a gallery view.
As you say @brian , the extensions have been removed from all the image page urls, so where are these old versions of urls coming from for thumbnail images on the profile page? Is this something cached that will correct itself later?

I will have a look at the profile page template and see if I can work out what's different, though I'm a novice at this.
brian
@brian
7 years ago
10,148 posts
What profile page is showing the image URL with the extension in place? Sounds like it could be a custom template that needs to be updated to use the correct URL.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
lornawebber
@lornawebber
7 years ago
334 posts
Well, this one for example https://pmp-art.com/tina-dumitru the first image shown in 'latest images' is this ' https://pmp-art.com/tina-dumitru/gallery/208046/red green .JPG.jpg ' (hover over the thumbnail of the ladybird on green leaves).
lornawebber
@lornawebber
7 years ago
334 posts
Also this one https://pmp-art.com/lornas-likes , has 2 images in 'latest images' and both show a .jpg extension.
brian
@brian
7 years ago
10,148 posts
Yeah I suspect the templates are using the wrong value for the URL - I'll check it out and let you know.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
7 years ago
10,148 posts
You should be good now - you had 3 templates that were using the incorrect value for the image URL:

index.tpl
item_list.tpl
profile_index_image.tpl

I've fixed those up and you should be good.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
lornawebber
@lornawebber
7 years ago
334 posts
Thank you so much @brian. That's brilliant. I'm most grateful.

Tags