Jump to content
thirty bees forum
  • 0

Set Category image thumbnail size


Cassim

Question

Hi, 

As it is now we have this imagetypes : 

  • niara_cart (unknown use)
  • niara_small (unknown use)
  • medium_default (product)
  • large_default (default for products)
  • Niara_thickbox (big images)
  • category_medium 
  • category_default (default for categories) 

So the issue here, is that i like the category_medium to be the one we use for the categories. But as it seems right now it is locked into the use of "medium_default" and as medium_default is set to a crazy size compaired to what we use in the categories, we can't use that.

The category_medium is set to 125x125px the medium_default is set to 350x200px 
So how can i make my thumbnail use the category_medium ?

As it is now this is how it looks in the backend : https://take.ms/pkyNY Meaning i won't be able to upload images to the thumbnail size. And again that gives me issues in terms of getting everything showing up right on the frontpage. 

I have the url setup right in the frontend no issues here. But the issue is still in the backend. It won't upload as long as it's not assigned to anything. As you see on the image https://take.ms/pkyNY the "px" is missing on the thumbnails. Here is a list of my full image view : https://take.ms/Tmsyg 

Any advise in how to fix this, so that i can get the right image size

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Looked into this, as I am rewriting the whole image usage in tb. The main issue here is ImageType::getFormatedName(). It's not been able to return 'category_medium'. We could improve this function by adding $imageTypes and $entityType stuff there. But it gets more complex, not sure if it helps in the long run. 

To have a very clean solution, we actually should get rid off all this ImageType::getFormatedName(). Instead we offer a select configuration somewhere. That's actually no difference, to how modules should integrate image usage, right @datakick?

Somehow this doesn't seem to be a quick fix 😳

Link to comment
Share on other sites

  • 0

@wakabayashii did do that, the "only" issue so to say is that it won't save the images now.

I did already test it after @datakick did return, and it do work, 

If i in my overwrite change all ref from medium to category_medium, it will update it to the /img/tmp folder, but it won't update them into the /c folder. 

If i upload both files (main and thumbnail) the files are generated fine, without any issues. But it will be using the main image that will create a category_medium file, and not my default "icon" 

I might be a issue in the upload/overwrite on the file when using the thumbnail upload.

Link to comment
Share on other sites

  • 0

Hmm. I can not test this right now, as I have seriously changed files on my testserver. Either you are "wrong" and it's more a caching issue or so. Or there is another bug. 

Imo there should be a file in "c" folder and with name "category_medium". 

But yeah probably it doesn't work in FO and maybe that's the reason, why you think saving doesn't work. Which theme are you using? Search for category.tpl and replace there 'medium' with 'category_medium' too.

Link to comment
Share on other sites

  • 0
2 hours ago, wakabayashi said:

To have a very clean solution, we actually should get rid off all this ImageType::getFormatedName(). Instead we offer a select configuration somewhere. That's actually no difference, to how modules should integrate image usage, right @datakick?

You are absolution 100% correct.

If these magic constants ('medium') didn't exists in the core code, there wouldn't be this problem in the first place.

Link to comment
Share on other sites

  • 0
40 minutes ago, wakabayashi said:

Imo there should be a file in "c" folder and with name "category_medium". 

If i upload a "cover" to the category - All files are created as needed. But if i like to change the thumbnail image, witch i do in this case here, as i have 2 dif image size (both attached now for better understanding) 

So if i uploade the 1100x200px image all is good, but the thumbnail image will then be created based on the 1100x200px image. 

If i then afterwords go ahead and upload the thumbnail image (in this case "star wars 001.png") the issue come, as it don't regenerate a new file. Even if i remove the file on the server within the /img/tmp & /img/c and try to upload it again it won't create a file.

 

43 minutes ago, wakabayashi said:

But yeah probably it doesn't work in FO and maybe that's the reason, why you think saving doesn't work. Which theme are you using? Search for category.tpl and replace there 'medium' with 'category_medium' too.

I have no issues on the frontend... ---> I do but that is as no images with category_medium is created 😉 

 

44 minutes ago, wakabayashi said:

Either you are "wrong" and it's more a caching issue or so. Or there is another bug. 

My idea was also cache, but again i did try to look on files based on the server and not on the frontend as i have some high amount of cache running. 

 

So mainly the "issue" now is to create the thumbnail image when uploading.

I have always had this issue, both when i was back in PS1.6 and now i TB1.3 
I do run on the default "Niara" theme, (with some modifications to the tpl files) 

Forside banner-High-Quality (1).jpg

Star Wars 001.png

Link to comment
Share on other sites

  • 0

Attached here is the result and the "way" of doing the upload at the start. 

I did try to remove the /img/tmp folder just to see what happened. 
It seems that on save it goes into the /img/tmp and loads the "category_120.jpg" file. And uses that to regenerate the images. 

*ERROR*     2023/02/14 - 14:36:23: unable to open image `/home/x/public_html/img/tmp/category_120.jpg': No such file or directory @ error/blob.c/OpenBlob/2882 at line 309 in file override/classes/ImageManager.php

120-category_default.jpg

120-category_medium.jpg

120.jpg

Skærmbillede 2023-02-14 kl. 14.34.01.png

Link to comment
Share on other sites

  • 0

Well you are on 1.3 and I am kind of 1.5 tb version. That could explain some differences. 

I now tested it for my version with the new image system. As I told you, I replaced 'medium' with 'category_medium' (3 places). Afterwards I uploaded a thumbnail. I did nothing else. In my case it cleanly generated the file 6-category_medium.webp (yours is probably jpg) in 67x67px (as I set it up). So it all worked as expected for me. 

Anyway: If my proposal is not working for you. I think you have to wait for my rewrite being merged. Afterwards you should upgrade to the bleeding edge and you will be fine. I expect my rewrite being finished in 1-2 weeks. But the merge will take additional time as at the moment 56 files are involved. So in a good case I would say in a month we have this integrated. In the worst case: Datakick will refuse my PR 😅

Link to comment
Share on other sites

  • 0
21 hours ago, datakick said:

You are absolution 100% correct.

If these magic constants ('medium') didn't exists in the core code, there wouldn't be this problem in the first place.

While trying to continue the rewrite and adding configuration selects, I noticed, that we have a general problem in image proccessing. Especially in this category controller. Cause normally when you upload an imageFile, you expect, that all imageTypes are generated for this imageFile. All entities do it like that. Only AdminCategoryController does missuse this concept:

Here an imageFile upload is linked (hardcoded) to a specific imageType. I don't like this at all. And it doesn't make super much sense, that we have this on categories but not on manufacturers and suppliers (both missing link_rewrite btw). 

I will try to rewrite this, so that we generate all imageTypes for 'image' and 'thumb' in AdminCategoryController. If it works, it would also be no big deal to add a second image upload for other product listing pages as manufacturer or suppplier. 

My ultimate goal is actually to have a consistent proccess over all entityTypes. In a perfect world we would probably even have ps_image for all entityTypes (but yeah that's not gonna happen soon).

  • Like 3
Link to comment
Share on other sites

  • 0

@wakabayashiThats a really great idea.
I know the way that Manufacturers are right now are crap. Special all about the category/manufacturers are not really great.
When thinking about categories / manufactures this are pages that you like to add multiple values to, both in terms of "before products" & "after products" elements. But you also like to have a option to show a "show more" / "show less" function on the first part of the text on the category page. Their are not default, they all need to be hardcoded into the system. 

We have already coded the before and after section for the categories. Im right now looking into optimizing the Manufacture pages, so that they are getting more and better options. Right now they are my 2. most valueble page and the don't even have much options to set. 

So here is also a great place to work on.
Why do we only allow a "logo" upload for the manufacutres, why don't we have 2 image uploads, so that we can uploade a great image showcasing that manufacture. 

For this types of pages, i have always been looking for a option to optimize the way it looks. If you take a page like this : https://uk.gamesplanet.com/publishers/14-warner - they really have a great way of building it. They have "top sellers" in the top, the have "focus" products, they showcase the logo with top-focus products, they really do a good amount of work to optimize the manufacture page https://take.ms/1DCbN i know it's a other system, but the options to customize the categori pages here are really great.

The last few months i have been working (at work) on a WP/Woocommce project, with. Generatedpress on. And what it's able to do, change and optimize is insane. You can build your own category page, just by adding elements into specific positions, all controlled by blocks. See that will really be awesome if that function will be coming to TB. 

But image part will be a great starting point. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...