Author Topic: Rebuild Thumbnails  (Read 33905 times)

gjrweb

  • Beginner
  • *
  • Posts: 16
Rebuild Thumbnails
« on: November 20, 2009, 15:29:46 pm »
I am using virtuemart 1.1.4, how to recreate thumbnails?

I have seen several topics already, but non worked for me on 1.1.4...

Thanks!
[GJ-R] Webdevelopment & E-Commerce Expert

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Rebuild Thumbnails
« Reply #1 on: January 11, 2010, 19:49:29 pm »
J 1.5.15 + VM1.14

http://forum.virtuemart.net/index.php?topic=34733.msg116853

1. delete images in resized folder.
2. sql: update jos_vm_product set product_thumb_image = product_full_image

Worked like a charm with gd library working (Dynamic Thumbnail Resizing). When setting the thumb image to full image, this will clear out all the old thumbs originally created when adding a new product. Clearing out the resized folder will delete all gd (dynamically) created thumbs. Now when gd goes to make new thumbs in resized, it will us the thumbnail set in product_thumb_image, which via sql you have set to be the full image. So it will create nice, clear, resized images!

RikkiTikki

  • Beginner
  • *
  • Posts: 3
Re: Rebuild Thumbnails
« Reply #2 on: February 02, 2010, 19:20:56 pm »
this is good idea but since i have done this thumbnails on the category page look as i wished, and on the product page they have blown my template:) does any have a clue?

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Rebuild Thumbnails
« Reply #3 on: February 03, 2010, 03:59:12 am »
If you want help, a little more detail would be necessary. "Blown" is very un-descriptive. A link to the product page would be nice too.

RikkiTikki

  • Beginner
  • *
  • Posts: 3
Re: Rebuild Thumbnails
« Reply #4 on: February 03, 2010, 08:24:54 am »
on the catdegory page they have the size just what i wanted, and  on the product page they are have the original size. sorry for my humour ::) u can see categories here & products here

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Rebuild Thumbnails
« Reply #5 on: February 03, 2010, 08:40:04 am »
MY guess is all you need to do is set your VM configuration setting for dynamic resize. This can be found at:

VM -> Admin -> Configuration

Check the box: Enable Dynamic Thumbnail Resizing?      
Set your: Thumbnail Image Width      
Set your: Thumbnail Image Height

That should do the trick.

RikkiTikki

  • Beginner
  • *
  • Posts: 3
Re: Rebuild Thumbnails
« Reply #6 on: February 03, 2010, 09:58:41 am »
i have done this already this is the printscreen of my config ???

n3m3sys

  • Beginner
  • *
  • Posts: 7
Re: Rebuild Thumbnails
« Reply #7 on: February 03, 2010, 12:56:41 pm »
Hi guys, i have the same problem too, after updating tables via sql, my new products thumbnail are regenerated well, but now, in the flypages my product thumb is the original size one! My previous thumb size was 150x150, i put it at 151x151, forcing the system to generate again my thumbs,so now i have in the "resized" folder, files with xxxxxxxx151x151.jpg name ???.What's happening? Thanks! :)
(GD working, and automatic resize checked on)

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Rebuild Thumbnails
« Reply #8 on: February 03, 2010, 19:29:21 pm »
Well, frankly guys I'm not sure. It does seem like the thumbnail feature took a hit for the worse in the latest revision.

n3m3sys

  • Beginner
  • *
  • Posts: 7
Re: Rebuild Thumbnails
« Reply #9 on: February 03, 2010, 22:24:51 pm »
Ok Forrest, i'm not an sql guru, but i'm thinking about the sql query...
if you said that

"update jos_vm_product set product_thumb_image = product_full_image"

sets the product_thumb_image to the product_full_image, maybe we can revert the situation setting back the original settings again,so that we can point to the new generated thumbs correctly, am i wrong?

"update jos_vm_product set product_thumb_image = product_thumb_image" sure will not work,maybe we need a "temp" table to do the "swap"?

Just thinking loudly...any ideas?

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Rebuild Thumbnails
« Reply #10 on: February 03, 2010, 22:47:36 pm »
No that won't work. Here what's should/typically happens.

1. You add a product/category photo.

2. If you have checked auto-generate thumbnail in the cat/prod folder when adding the photo, it will generate a thumb based on the size params in your config... such as 150x150. So the system adds two images.
   a. The full image in /products/xxxx.jpg
   b. The auto-gen thumb image in /products/xxxx_150x150.jpg

3. Then if you turn on the GD system, it should rebuild again the thumbnails, from the product_thumb_image, into a folder called /products/resized/xxxx_150x150.jpg


So why rebuild the thumbnails (not rezised, but actual thumbnail product_thumb_image) using "update jos_vm_product set product_thumb_image = product_full_image"?
Typically you would do this to have your GD library rebuild the RESIZED folder images. You would most likely chose to do this if your product thumb image is 150x150 but you have decided to change the size of your thumbnails to say 250x250.

Since the GD library is using the product_thumb_image to generate new 250x250 images, the images come out bad. Why? Becuase when you first added photos you had it set to 150x150, so the GD library is using a smaller image and trying to BLOW IT UP LARGER.

So what we did was set the product_thumb_images EQUAL to the product_full_image so when the GD library made new 250x250 images in the resized folder, it use the full_image, which is now also the thumb image in the database.


I hope this provides a better understanding of Product_full, Product_thumb, and RESIZED. The problem is that the code for some reason is not pulling form your resized folder, or your gd library is not working to create your resized images, which you can check in your resized folder.

About the only way to revert back to what you had is to
1. Know what your previous resize setting was. (you can check by looking in your product folder! The images are still there)
2. If it was 150 x 150 then you could do something in php to execute a command that replaces xxxx.jpg with xxxx_150x150.jpg for all product thumb images in your database table column product_thumb_image.


I would not do this first. I would
1. Back up my resized folder, then delete it!
2. Browse my website so it forces the GD library to rebuild the thumbs on the fly according to my GD settings... say 250x250.
3. Check my new resized folder to see if the GD library is working and creating 250x250 images for each product.
4. Clear my cache.
5. Revisit my site and see if the code is now pulling from my resized folder.
/product/resized/xxxx_250x250.jpg

Good luck! I will say I have not encountered problems with this until 1.1.4.. something is not kosher. :(

n3m3sys

  • Beginner
  • *
  • Posts: 7
Re: Rebuild Thumbnails
« Reply #11 on: February 03, 2010, 23:03:37 pm »
Got it, just now i'm trying to put my old thumbs on (i back'd up  ;)), i'll let you know what happens.

Quote
If it was 150 x 150 then you could do something in php to execute a command that replaces xxxx.jpg with xxxx_150x150.jpg for all product thumb images in your database table column product_thumb_image.

Yeah, same idea!I think i'll need some sql night session  ::)

For now,thanks friend!

n3m3sys

  • Beginner
  • *
  • Posts: 7
Re: Rebuild Thumbnails
« Reply #12 on: February 04, 2010, 00:26:46 am »
Bingo!!! ;D
No matter how you delete/recreate thumbs, the problem it's in the database,
if you look in the "jos_vm_product" table, the images path it's store without the "resized/" initial path,that's why flypages goes on pointing the originally-sized images.I looked on a previous backed up database and matched.I tried changing a pair of them, and worked nice.Maybe a bug? Dunno.
Now....what for adding the "resized/" part before the path for all of them?

You're right, something's not kosher  8)

Forrest

  • Full Member
  • ***
  • Posts: 1972
  • Me and my baby
    • Web Developer
Re: Rebuild Thumbnails
« Reply #13 on: February 04, 2010, 01:07:53 am »
Well actually, the database should not have resized/ in it. This is becuase, the thumb is stored in the Product folder.

Again:
product/xxxx.jpg = full
product/xxxx_150x150.jpg = thumb

what get puts in the RESIZED FOLDER is the dynamic GD library builds. The reason it is a problem with the code is that...

1. If you have GD library on it will create:
product/resized/xxxx_150x150.jpg (= GD thumb)
from
product/xxxx_150x150.jpg (= original thumb when adding product image)

2. This only happens dynamically! Which means these images are created when you visit the category for the first time when the product image resized. This is NOT a database entry. the database will still say product/xxxx_150x150.jpg for product_thumb_image.

3. THE !!!CODE!!! as you entry a category should do this:
IF GD LIBRARY ON
THEN LOOK TO SEE IF IMAGE IS IN RESIZED FOLDER
IF IN RESIZED FOLDER USE THAT!
IF NOT IN FOLDER THEN CREATE ONE.

My problem is that the GD library is ON, the GD system is creating the thumbs, but the resized thumbs are NOT BEING USED!

Again the code is not using the databse thumb entry when GD is on, but rather checking to see if the image is in existence in RESIZED folder, and if it is then use it, and if it's not, then create one from the product_thumb_image and put it in resized folder.

If GD library is not on, then the system will just use the product_thumb_image that is in the database, which seems to be your problem as well! It's acting like the GD library is off and is only using the database entry, and not checking to see if an image exists in the RESIZED folder to use.

Now I have looked into this some, and have found a 00 appended to my src, which is not correct, and have posted a fix to this, but there is still something else in the checking of the image that is failing.

:(

n3m3sys

  • Beginner
  • *
  • Posts: 7
Re: Rebuild Thumbnails
« Reply #14 on: February 04, 2010, 01:32:19 am »
Forrest i understand the thumb generation mechanism,but like you can't understand why it's generating thumbs but it's don't using them...i'll keep on brainstorming...we have exactly the same problem.

look here
http://www.ideeriflesse.it/catalogo-prodotti?page=shop.product_details&flypage=flypage_images.tpl&product_id=24&category_id=14

the image location is
http://www.ideeriflesse.it/components/com_virtuemart/shop_image/product/resized/Fungo_4af87b98e7a9f_150x150.jpg, so it added correctly the "150x150" in the thumb name.

and the image link is
http://www.ideeriflesse.it/components/com_virtuemart/shop_image/product/Fungo_4af87b98e7a9f.jpg   ...the full sized one.

I made a test product, named..."test", everything works ok for new products.
I noticed that the "more images" thumbs of the old products are NOT affected by this,maybe this helps? Regards.