JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 6 forks source link

Change of the 'Image types' names in comparison to JoomGallery 3.x #213

Open MrMusic opened 3 months ago

MrMusic commented 3 months ago

To display a JoomGallery 3 image in a Joomla article, for example, the following has been placed in the IMG tag: For example the Thumbnail: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=thumb" Detail image: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=img" Original image: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=orig"

In JoomGallery 4 the types have been changed: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=thumbnail src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=detail src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=original

Due to this name change, after a migration from JG3 the images are no longer displayed in articles.

DE: Änderung der 'Image types' Bezeichnung gegenüber der JoomGallery 3.x Zur Anzeige eines Bildes der JoomGallery 3 in z.B. in einem Joomla Beitrag, wurde folgendes in das IMG Tag eingesetzt: Für das Thumbnail beispielsweise: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=thumb" Detailbild: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=img" Originalbild: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=orig"

In JoomGallery 4 haben sich die 'types' geändert: src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=thumbnail src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=detail src="index.php?option=com_joomgallery&view=image&format=raw&id=123&type=original

Durch diese Namensänderung werden nach einer Migration von der JG3 keine Bilder in Beiträgen mehr angezeigt.

Tazzios commented 2 months ago

i`m not sure or it is useful but here some SQL that could do the replacements:

Article content

UPDATE #__content
SET 

    /*replace firstpart of url*/
    `introtext` = REPLACE(introtext, '&view=image&format=raw&id=', '&view=image&format=raw&id=')
    `FULLTEXT` = REPLACE(FULLTEXT, '&view=image&format=raw&id=', '&view=image&format=raw&id=')  
    `images` = REPLACE(images, '&view=image&format=raw&id=', '&view=image&format=raw&id=')  

    /* replace secondpart of url*/
    `introtext` = REPLACE(introtext, '&type=thumb', '&type=thumbnail'), 
    `introtext` = REPLACE(introtext, '&type=img', '&type=detail'),
    `introtext` = REPLACE(introtext, '&type=orig', '&type=original')        

    `FULLTEXT` = REPLACE(FULLTEXT, '&type=thumb', '&type=thumbnail'),
    `FULLTEXT` = REPLACE(FULLTEXT, '&type=img', '&type=detail'),
    `FULLTEXT` = REPLACE(FULLTEXT, '&type=orig', '&type=original')

    `images` = REPLACE(images, '&type=thumb', '&type=thumbnail'),
    `images` = REPLACE(images, '&type=img', '&type=detail'),
    `images` = REPLACE(images, '&type=orig', '&type=original')  
WHERE 
  `introtext` LIKE '%&type%' 
  OR `fulltext` LIKE '%&type%'
  OR `images` LIKE '%&type%'

Custom modules

UPDATE #__modules
SET
    /*replace firstpart of url*/
    `content` = REPLACE(content, '&view=image&format=raw&id=', '&view=image&format=raw&id=')    

    /* replace secondpart of url*/
    `content` = REPLACE(content, '&type=thumb', '&type=thumbnail'), 
    `content` = REPLACE(content, '&type=img', '&type=detail'),
    `content` = REPLACE(content, '&type=orig', '&type=original')    

WHERE 
    `module` = 'mod_custom' 
    AND  `content` LIKE '%&type%' 
MrMusic commented 2 months ago

@Tazzios : Thank you for the script. But I'm not sure if we should do that. Changing the content in Joomla via SQL could cause problems... It would be better if there is another solution than editing the content tables with SQL.