Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Automatic ALT, Title, and alias

5 years 3 months ago #1

  • Ronen's Avatar
  • Ronen
the photos i am uploading for every sub-category are many and of patients so i don't want really want to make ALT, Title, and alias for each one...is there a way for the gallery to pick them from the image title and fill all these automatically?

5 years 3 months ago #2

  • Artem's Avatar
  • Artem
  • Posts: 9773
We can help you only with title.

1. Update your Gallery to version 2.0.6
2. Go to: components/com_bagallery/helpers/bagallery.php
3. After Line 921 add this code:
$ext = JFile::getExt($image->url);
            $image->title = str_replace('.'.$ext, '', $image->name);

Regards,

5 years 3 months ago #3

  • Ronen's Avatar
  • Ronen
it will be overwrite by template...no way to add this option into settings? is there a way to make it not overwrite?

5 years 3 months ago #4

  • Ronen's Avatar
  • Ronen
also, i added this code, cleared cache and still no alt="" filled in the image html source
Attachments:

5 years 3 months ago #5

  • Artem's Avatar
  • Artem
  • Posts: 9773
In the first reply I wrote, that we can help only with title. This feature works only for title. URL and ALT you need to enter manually

5 years 1 month ago #6

  • Min's Avatar
  • Min
  • Posts: 28
Artem wrote:
In the first reply I wrote, that we can help only with title. This feature works only for title. URL and ALT you need to enter manually

Hello Artem,
I think I have a possible solution for the ALT (and also for the TITLE) - if its ok for you I post it here ;)
Regards,
Min

5 years 1 month ago #7

  • Artem's Avatar
  • Artem
  • Posts: 9773
Min wrote:
I think I have a possible solution for the ALT (and also for the TITLE) - if its ok for you I post it here ;)

Yes, sure! Much appreciated! :cheer:

5 years 1 month ago #8

  • Min's Avatar
  • Min
  • Posts: 28
:cheer: ok here the steps:

1. Update your Gallery to version 2.0.7
2. Go to: components/com_bagallery/helpers/bagallery.php
3. delete line 919 - 920
4. instert instead the two lines following code:
$ext = JFile::getExt($image->url);
$image->name = str_replace('.'.$ext, '', $image->name);
$html .= " alt='" .$image->name."'";
$html .= " title='" .$image->name."'>";
            $html .= "<div class='ba-caption'><div class='ba-caption-content'>";
			
$ext = JFile::getExt($image->url);
$image->title = str_replace('.'.$ext, '', $image->name);

Tested it with every gallery layout - checked the source code and the alt and title are always filled out - and with this customization you doesnt need to fill out the title for the img in backend - it displays the picture name as title ;)

Attached a screenshot with the customized section



Hope it helps anyone :cheer:

Regards,
Min

5 years 1 month ago #9

  • Ronen's Avatar
  • Ronen
Thanks for the fix, i put a test page to see if google crawl the gallery photo (not thumbnails, the pop-up)...it's been up for 2 months....Google doesn't show one single image when searching it...while i did a simillar page with "simple gallery pro" by joomwork and google shows all the images, (i have removed lazy load and refresh too)

5 years 1 month ago #10

  • Min's Avatar
  • Min
  • Posts: 28
Ronen wrote:
Thanks for the fix, i put a test page to see if google crawl the gallery photo (not thumbnails, the pop-up)...it's been up for 2 months....Google doesn't show one single image when searching it...while i did a simillar page with "simple gallery pro" by joomwork and google shows all the images, (i have removed lazy load and refresh too)

How did you check if the images are crawled?

A recommended note:
After the code changes DISABLE the joomla cache (if enabled) and
  • a) delete the whole pictures from the folders, save it and add it again
  • b) create a new galllery with same settings / folders
After this steps open the page and let the gallery create the thumbnails /images - after that you can ENABLE the cache function again.
Background of this: I noticed that when in the folders are many pictures in, for some pictures the .jpg, .png extensoin are not removed in the name, it is a cache /temp problem - after the recreation all names are correctly..

@Artem Thanks for the permission to share this "mod" :lol: ;)

Regards,
Min

5 years 1 month ago #11

  • Ronen's Avatar
  • Ronen
i did a search on google photos with the name of the picture, same process for simple image gallery pro...for the page where balbooa gallery it didn't list any photo...only thumbnails from that page, for simple image gallery pro it showed all the photos

Part of the message is hidden for the guests. Please log in or register to see it.

5 years 1 month ago #12

  • Min's Avatar
  • Min
  • Posts: 28
Ronen wrote:
i did a search on google photos with the name of the picture, same process for simple image gallery pro...for the page where balbooa gallery it didn't list any photo...only thumbnails from that page, for simple image gallery pro it showed all the photos

Have you adjust the changes from my post above? Your source code looks "original" - no alt and no title are shown - I tried it with my gallery (you have grid layout, or?) and on my page the attributes are filled out..

5 years 1 month ago #13

  • Ronen's Avatar
  • Ronen
so if i have 100 galleries i will need to re-do them all for this to work? and what about future updates that will delete that code?
*btw, i have the "justified" layout

4 years 10 months ago #14

  • Paul's Avatar
  • Paul
  • Posts: 15
Is there any word on the request in this thread to have the ability to auto-assign the Image Title from the File Name added as a feature within the Gallery admin area?

I would find this very helpful.

Note: for a new site i am setting up I have used the work around mentioned above and works ok.

4 years 10 months ago #15

  • Min's Avatar
  • Min
  • Posts: 28
Update (for version 2.1.0)

1. Update your Gallery to version 2.1.0
2. Go to: components/com_bagallery/helpers/bagallery.php
3. delete line 1011 - 1012
$html .= " alt='" .$image->alt. "'>";
$html .= "<div class='ba-caption'><div class='ba-caption-content'>";
4. instead of the two lines insert following code:
$ext = JFile::getExt($image->url);
$image->name = str_replace('.'.$ext, '', $image->name);
$html .= " alt='" .$image->name."'";
$html .= " title='" .$image->name."'>";
            $html .= "<div class='ba-caption'><div class='ba-caption-content'>";
			
$ext = JFile::getExt($image->url);
$image->title = str_replace('.'.$ext, '', $image->name);
:cheer:
Regards,
Min

4 years 4 months ago #16

  • Min's Avatar
  • Min
  • Posts: 28
Update (for version 2.2.4)

1. Update your Gallery to version 2.2.4
2. Go to: components/com_bagallery/helpers/bagallery.php
3. delete line 1371 - 1372
$html .= " alt='" .$image->alt. "'>";
$html .= "<div class='ba-caption'><div class='ba-caption-content'>";
4. instead the two lines insert following code:
$ext = JFile::getExt($image->url);
$image->name = str_replace('.'.$ext, '', $image->name);
$html .= " alt='" .$image->name."'";
$html .= " title='" .$image->name."'>";
            $html .= "<div class='ba-caption'><div class='ba-caption-content'>";
			
$ext = JFile::getExt($image->url);
$image->title = str_replace('.'.$ext, '', $image->name);
:cheer:
Regards,
Min

4 years 2 months ago #17

  • Thomas Kutter's Avatar
  • Thomas Kutter
  • Posts: 23
Hi Artem,

is there no solution for this problem. With each update we have to go into the code and change it manually. Can you not install a checkbox and query, if this is set, then take the title of the image?

Regards Thomas

4 years 2 months ago #18

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 22680
Hello,

It seems you've missed ;)
It already been added (no more necessary to add code)
Read more in this post
www.balbooa.com/blog/gallery/balbooa-joo...res-and-improvements

Regards,
Vyacheslav, Balbooa.com

4 years 1 month ago #19

  • Strng's Avatar
  • Strng
  • Posts: 6
I want to leave symbol ''." in the title of image after executing "Filename to Title" process. For example, filename is "Main st. view.jpg", but title of this image will be "Main st view" (without dot). Can you help me?
Powered by Kunena Forum