You are here:  » Image URL Cut Off So Image Not Displaying

Support Forum



Image URL Cut Off So Image Not Displaying

Submitted by bat on Wed, 2021-11-03 21:30 in

Hi David,
On a feed I have, the Image URL is rather long on some products and the end of the URL is being cut off and so on those products the image isn't showing/it's broken.
What do I need to do to ensure that the full URL from the feed is imported into the database please?

Thank you :)

Submitted by support on Thu, 2021-11-04 08:34

Hi,

Here's a dbmod.php script to change the image_url to 1024 characters...

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            CHANGE `image_url` `image_url` VARCHAR(1024) NOT NULL"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Thu, 2021-11-04 23:28

Awesome, thanks David!

Submitted by bat on Sun, 2022-07-31 14:13

Hi David,,
Could a similar sort of thing be done for the category name provided by the feed?

I've realised that part of the category names are being cut off which has made mapping awkward.

Thanks.

Submitted by support on Mon, 2022-08-01 10:50

Hi,

Sure - the category field is part of a compound index so can't be made so big but can be increased to around 150 characters with the following dbmod.php script;

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$config_databaseDebugMode TRUE;
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            CHANGE `category` `category` VARCHAR(150) NOT NULL default ''"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Tue, 2022-08-02 11:35

Hi David,
Thank you. I tried the running the code you attached and received this:

[ALTER TABLE `products` CHANGE `category` `category` VARCHAR(150) NOT NULL default ''][Specified key was too long; max key length is 1000 bytes]Done.

Submitted by support on Tue, 2022-08-02 11:48

Ah sorry about that; 96 should be OK using

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$config_databaseDebugMode TRUE;
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            CHANGE `category` `category` VARCHAR(96) NOT NULL default ''"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Tue, 2022-08-02 13:31

Looks like it's coming up with the same thing.

[ALTER TABLE `products` CHANGE `category` `category` VARCHAR(96) NOT NULL default ''][Specified key was too long; max key length is 1000 bytes]Done.

Does the VARCHAR go up in certain increments or can I try any number less than 96 to see if it takes effect?

Submitted by support on Tue, 2022-08-02 13:52

That's strange it does rely on underlying data storage but yes it's fine to reduce the number but I would suggest a decrement in reasonable powers of 2 downwards e.g. 8 so try in this order;

VARCHAR(88)
VARCHAR(80)
VARCHAR(72)

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Tue, 2022-08-02 14:50

VARCHAR(72) seemed to be the magic number.
Thanks!