I am looking for options to extract the main image from a product page on a retailer website, the problem is there are multiple images in a product page (related images) , one approach I thought would work would be to extract all the image links, download each one of them and compare the size of each of those images and consider the one has the largest size in terms of storage bytes as the one that is the main product image.
Obviously that would be a very inefficient approach , we know that most of the retailers use certain ecommerce platforms like magento , bigcommerce etc, the major ecommerce platforms are only handful , is it possible to detect the ecommerce platform and leverage the template provided by each one of them to precisely extract the main product image?
I know the approach would never be perfect , but I am looking an algorithm that would be mostly accurate about 80% or so , is it doable?
Do you have a list of retailers that you're looking to extract the images from? If so, then go through each retailer's site manually, look at its HTML, and create some code that would successfully extract the image from this particular retailer. If not, then I'm afraid you're out of luck - you could just grab the biggest image on the page, or use some other heuristic, but there's no guarantee that you're grabbing the actual product image.
The problem with creating some sort of generic utility is that each e-commerce platform has its own structure for displaying product images, and that structure could be changed with each site. For example, just because Magento usually structures its images in a certain way, doesn't mean you'll always see them that way - it's entirely up to the theme that's currently applied.
You can use simple dom html lib to extract html. In terms of magento, the product thumbnail image is the img tag inside "product-image" class on product page. You can extract it as a good sized thumbnail image.
If you know the retailers and image as well download it through a script and check the sizes in a foreach loop statement and save the biggest one.
Thanks
Related
I have a test site where some imported product images are not being displayed on the category view or the search view.
It does however show up on the product page.
These products were imported / updated to reflect new images.
Category view
http://sales.magentocommerce.net.au/index.php/irrigation/driptube.html
Product view page
http://sales.magentocommerce.net.au/index.php/irrigation/driptube/221002-drip-eze-pc-13mm-2l-h-0-3m-50m.html
Other products whose images were uploaded manually is showing up.
All cache has been cleared and disabled in Magento.
What else am I missing.
I suspect the database records got screwed up somewhere on these products.
I am running out of ideas to what else to look out for and need a fresh pair of eyes.
Magento ver. 1.9.0.1
It sounds like you forgot to reindex your data.
Go to System -> Index Management, click select all (or at least select the first four indexes) and then press submit to reindex.
I note your image is almost 2MB. On my shared hosting with 1and1, I cannot use such large images as Magento's image processing (eg producing thumbnails) falls over as it runs out of memory. I therefore have to preprocess any large images to shrink them down to something my Magento can handle.
One other thing, png files tend to be significantly larger than jpg files.
Multiple featured images
In Wordpress you can set a "featured image". I need to add multiple featured images dynamically.
Dynamically number of featured images
When I say dynamically I mean, for one post I might want 2 images and for the next one 6 featured images. The number is unknown.
Just loop them out, when done
When in the theme I just loop them out with a foreach loop. Featured images are stored as custom fields. This part I can handle.
A plugin might do it?
I know of http://wordpress.org/extend/plugins/multiple-post-thumbnails/ but here I need to deside the number of images from the start. My number is unknown.
Plugin, script or good articles are welcome.
I recently added a plugin to a wordpress plugin repository which simulates the need of dynamic multiple featured image. You can check it out here.
Any suggestion, pull requests, issues, and plugin recommendations are more than welcome! Interested can join the development at GitHub.
The answer was to use Advanced Custom Fields. It's very powerful plugin for adding custom fields of all kinds.
The addon "Repeater" did the trick.
Depending on how you're planning to use your featured images, you might be able to just add them as a gallery to your post/page. Then, you could use one of these snippets to access your gallery images on your listing and detail pages:
Snippet 1
Snippet 2
The biggest drawback to this method is that they aren't featured images by the strict WordPress definition, so any themes or functions that are depending on them won't exactly work right.
I'm having trouble finding a joomla module that displays articles on rows and columns, each article with a thumbnail and a title or a small description. For e.g. I want to put it on my first page with 3 columns and and 5 rows, for a travel agency website.
Does anyone know of such module? Could anyone help me find it?
If not, any idea of how I could build it? (very last resort)
Thanks!
Since native Joomla articles do not support thumbnails out of the box you are probably better off using a CCK to accomplish what you want. I know at least Zoo and K2 support images related to an item without any extra code and both have the ability to display content as you have described.
We've got a site where the customer sells physical, printed sheet music. They also have sample audio recordings of what the various compositions sound like, and they'd like to add these recordings to the product pages themselves. Among other things, the purpose of the recordings is to let a shopper play a recording of the composition so they know what they're buying.
The only way I can see to do this, without creating custom fields that we need to manually manage, is to create all the products as "Downloadable Products", and attaching the samples. The problem with doing a downloadable product, however, is that it actually has to have a downloadable component - my customer is not interested in selling, for example, PDFs of the sheet music. In our digital age you might think this silly, but they've already looked into doing this, and the end result is that sheet music is a little different than say, a book. Layout and formatting issues prevent sheet music from being a great candidate for digital distribution right now, since precise layout of the scales and notes is critical - i.e. the data is much more complex than text.
Any suggestions on how to pull this off? Are there extensions available that do this? I'd imagine an online store that sells physical CDs or vinyl wanting to have audio samples next to their products for the same reason.
Found a much simpler solution, which I didn't realize existed:
http://www.magentocommerce.com/boards/viewthread/32647/
Basically, the "Description" and "Short Description" fields on a product accept raw HTML, including <script> tags, which allow you to easily embed, for example, a Flash-based audio/video player, or even a YouTube video via an <embed> tag.
Tim Reynolds also pointed out that, if you use the WYSIWYG editor, these tags may get automatically filtered out, so watch out for that.
I think adapt Mage_Downloadable is not the best way. Once that customer need to order (without cost) the downloadable product to gain access to download, maybe useless.
I don't mind that add a file (or a link to a public) to an attribute is hard, have to be more easy than change downloadable products to work in this way.
I think you need a simplest way of this extension: http://www.magentocommerce.com/magento-connect/magemechanics/extension/3027/product-file-upload. I'm right?
I want to create a nicely crafted featured product slideshow on the homepage. And for that, I want to pick a single unique images of that product. Is it possible get that specific product images based on the label to be shown on the featured product slideshow on the homepage? Or is there any other better way to do that (getting a specific email with certain identifier)?
thanks before :)