Keyword

[SOLVED] Keeping orginal names in my images

  • Matteo Quarantiello
  • Matteo Quarantiello's Avatar Topic Author
  • Offline
  • New Member
More
9 years 1 month ago #141364 by Matteo Quarantiello
Keeping orginal names in my images was created by Matteo Quarantiello
Hi all
As wroten in the title, i would like to know if i can maintain the original names of images when they are copied in /media/k2/items/cache after their reshaping in new format sizes (XS, S, M, L, XL).

I read few topics about this problem and about someone who succeeded modifyng directly the code.
Unfortunately those modifications were made on old k2 version and i couldnt' understand how to resolve my problem because my PHP knowledge is not pretty good.

In particoular, i recommend
www.gavick.com/forums/general-discussion/seo-k2-image-18208
gist.github.com/drmmr763/e9592e5b44f71d8872a0
www.joomlaworks.net/forum/k2-en/38390-solved-k2-images-renamed,-keep-original-file-name

But my question is: does somebody know if there is any official implementation of this kind?
I just started to organize 3000 images (from a FB fan page) for a new website e i need that the SEO is extremely worth.

Someone would be able to help me to implement this feature?

Thank you very much

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #141374 by Krikor Boghossian
Replied by Krikor Boghossian on topic Keeping orginal names in my images
To the best of my knowledge an extension does not exist.
As for an official implementation the official implementation is how K2 works.

As for SEO, since K2 uses the title and alt tags there won't be an issue. Just make sure to change Joomla!'s default robots.txt

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #141480 by Joe Campbell
Replied by Joe Campbell on topic Keeping orginal names in my images
I personally recommend using extra fields to produce all of your K2 images (category list, tag list, item page) for full control.

This way, you can optimize your image (Photoshop, Image Ready, SmushIt, etc.) and your ensured that is will be served up as you saved it (no additional formatting and/or compression)

Use the following code to output your image for each respective page:

Item & Category Override
<?php echo $this->item->extraFields->IMAGE_ALIAS_NAME->value; ?>

Tag Override
<?php echo $item->extraFields->IMAGE_ALIAS_NAME->value; ?>

Note: if you use the Image Type extra field, K2 will output the full HTML image markup (which lacks for full customization). If you want to ONLY output the image path so you can have full control over how to use it (apply classes, inline styles, alt & title tag based on extra field values, etc.) then you will need to execute the following hack:

Output K2 Image Extra Field as file path (without image markup) - K2 Hack

file: /components/com_k2/models/item.php

replace...

$value = '<img src="'.$src.'" alt="'.$rows[$i]->name.'" />';

with...

$value = $src; // K2 HACK - removed image markup

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 weeks ago #141512 by Krikor Boghossian
Replied by Krikor Boghossian on topic Keeping orginal names in my images
Hello Joe,

Thank you for sharing your knowledge :)
I think the hack is not needed, you can get the source of the image using the preg_replace() function.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago #141518 by Joe Campbell
Replied by Joe Campbell on topic Keeping orginal names in my images
Thanks Krikor, I am not a coder - please provide instructions/exact code in order to execute (Many Thanks)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 weeks ago #141527 by Krikor Boghossian
Replied by Krikor Boghossian on topic Keeping orginal names in my images
This will help you.
getk2.org/documentation/tips-a-tricks/1129-extra-field-image-type-as-link

The $var variable is the actual image URL.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago #141580 by Joe Campbell
Replied by Joe Campbell on topic Keeping orginal names in my images
I tried that, but it did not work, that is why I was forced to hack the code.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 weeks ago #141599 by Krikor Boghossian
Replied by Krikor Boghossian on topic Keeping orginal names in my images
Is your project on Github or sth similar?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
9 years 3 weeks ago #141618 by Joe Campbell
Replied by Joe Campbell on topic Keeping orginal names in my images
No - it's ok, I can live with the hack. In fact, I have documented all of my hacks so I can systematically deal with them when I upgrade. Thanks

Please Log in or Create an account to join the conversation.

  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
  • Offline
  • Platinum Member
  • Aham Brahmasmi
More
9 years 2 weeks ago #142005 by Kannan Naidu Venugopal
Replied by Kannan Naidu Venugopal on topic Keeping orginal names in my images
Kittens die when you hack k2 source codes... :D

You can also upload your own image using a simple plugin - the K2 example plugin is an example.

K2 Rocks \m/

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum