I my thumbnails are not showing properly for multiple image view. On the admin side I can see all the different image set for a single product. I selected the default main, base and thumbnail image but on the front end I only see the default image. The other images dont show instead the default image is repeated.
Ok nevermind I have found the problem. An extension was causing the conflict. I just simply unistalled the extension and everything started working Ok.
The culprit extension is called, 'Image Permalink' or 'IG_NamedImages' in the magento connect.
Please let me know if anyone was having the same problem
I fixed this module editing the IG_NamedImages_Model_Product_Image as the following:
class IG_NamedImages_Model_Product_Image extends Mage_Catalog_Model_Product_Image
{
public function setBaseFile($file)
{
parent::setBaseFile($file);
if (Mage::helper('ig_namedimages')->getIsEnabled()){
$product = $this->getProduct();
$imageName = Mage::getSingleton('catalog/product_url')->formatUrlKey($product->getName());
$this->_newFile = preg_replace('/\/([^\/]+\.\w+)$/', '/'.$imageName.'-\1', $this->_newFile);
}
return $this;
}
}
Related
I tried to update my image for category banner using Laravel(v8).
This is my code to update any image, first thing I checked was whether there is any image. If there ware any, I removed them. Then I added the new image.
But it showed me this error, Serialization of 'Illuminate\Http\UploadedFile' is not allowed ,When tried to update image.
Please help me to solve this.
Edit: My image was update without delete the old image.
if($request->hasFile('image') && $request->file('image')->isValid()){
$image = $request->file('image');
$imageName= $image->getClientOriginalName().Str::random(5).'.'.$image->getClientOriginalExtension();
$image->storeAs('category_image', $imageName);
$category = Category::find($id);
if($category->banner !==null){
unlink(public_path().'/allfiles/category_image/'.$category->banner);
}
$category->banner = $imageName;
$category->save();
}
Category::find($id)->update([
'name' => trim($request->category)
]);
Error messages,
This is error detail's
This error showing
I don't know what was the actual problem, I removed old image link manually from the database and then tried to update a new image. Then it got updated successfully. Next, I updated the same image again to confirm whether it works or not, and it worked without any error. Maybe it was the problem with the browser session or the previous database image link.
I am working in a CakePHP application, where I am using HTML helper's image() function to show images. What I want, if it gets the image in the given path, then it will show the image, otherwise, it'll show a default image. I have that "default" image, but I don't understand where/how to define it.
Thanks
Extend the HTML helper and add the logic to the image method and override the called image with your default image if the originally requested image does not exist.
index.ctp file code
<?php
$MyImage = $post['Post']['image0']; // image0 is my db field
if (file_exists("img/uploads/posts/".$MyImage))
$MyImage1 ="/img/uploads/posts/".$MyImage;
else
$MyImage1 = "/img/uploads/posts/no-image.jpg";
echo $this->Html->image($MyImage1);
?>
Note : My post's images are stored in app/webroot/img/posts folder(default image is also in this folder.)
I have been trying to import products into Magento and images. The products are being imported and created properly but the images to not get imported.
I am aware of the basics of importing as I have done it in the past but cannot figure out what the issue is and what to do next.
some notes how and what I did:
I am aware to add a "/" before the image name
image name is case sensitive
upload images in media/import folder
media folder to be 777
Tried different folders like var/import or
media/catalog/product/import
Removed the .htcaccess file in media
Flushed cache
when i upload manually an image on a product it does show up properly
i tried specifying the _media_attribute_id in a column as 88 maybe
that should help but it didn't
If you have a Mage_Catalog_Model_Product, all you need to do is this:
$fn = '/absolute/path/to/image.jpg';
$types = array('thumbnail', 'small_image', 'image'); // or null if you already have the product's thumbnail, small image, and image set
$move = true; // move the source file, don't leave it sitting around
$exclude = false; // enabled in product view
$label = 'Turquoise';
$product->addImageToMediaGallery($fn, $types, $move, $exclude); // Strictly speaking, only the first parameter is required
if(!empty($label)) {
$gallery = $product->getData('media_gallery');
$gallery_img = array_pop($gallery);
$gallery_img['label'] = $label;
array_push($gallery['images'], $gallery_img);
$product->setData('media_gallery', $gallery);
}
$product->save();
I have faced the same problem while uploading product image. And i tested many methods to figure that out. But nothing helped me. At last in one of the tutorial I have seen that the image name and the sku name has to be same. with the extension of file extension. So i followed it and by God's grace it worked. You may try that also. It worked for me. I had spent almost one full day to figure that out.
I'm using a Magento 1.4.1.1 install that I'm having issues with the javascript on a custom themed store.
For example, going to any product page (e.g. http://www.papakuraeducation.co.nz/index.php/teachers/magic-caterpillar-handwriting-casey-caterpillar-small-book.html) loads a Javascript file, which contains code which is supposed to scale down the .jpg file to fit the 'product-image' container it sits inside.
The relevent code seems to be around line #10279, which is causing a exception that $(imageEl).parentNode = null
Product.Zoom.prototype = {
initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){
this.containerEl = $(imageEl).parentNode;
this.imageEl = $(imageEl);
this.handleEl = $(handleEl);
this.trackEl = $(trackEl);
this.hintEl = $(hintEl);
(snipped...)
I've tried debugging it in Chrome and adding breakpoints, but tbh I'm not actually sure how to use this information to find the solution.
Any help in pointing me in the right direction would be greatly appreciated.
You have to add an ID to the <IMG> in question. This ID should than be fed into the following code-space:
product_zoom = new Product.Zoom('IMAGE_ID', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
I'm using an add Print order button to print a customer's order (not invoice) and I can't figure out how to get the logo to show up on the pdf. The following is the code that is in the extension but I can't find the function to manipulate it and I don't understand why it's not pulling the logo that I have in configuration. Please advise. :)
$this->insertLogo($page, $order->getStore());
You probably don't have store logo for PDF set. In admin you should go to
System -> Configuration -> Sales -> Sales -> Invoice and Packing Slip Design
and set your logo there.
Now for the logn explanation in case the above won't work :)
insertLogo function is located in class Mage_Sales_Model_Order_Pdf_Abstract (I asume that your class derives from it).
The rows that you should note are $image = Mage::getStoreConfig('sales/identity/logo', $store); and $image = Mage::getBaseDir('media') . '/sales/store/logo/' . $image;
getStoreConfig function is looking for the name of logo image in core_config_data table. You can check if the value is set with
SELECT * FROM core_config_data WHERE path = 'sales/identity/logo'
If the query won't return anything or will return value that is not an image name then you'll have to set that value first.
If that value is set you should have a look in
/your_store_root_dir/media/sales/store/logo/value_that_is_in_the_database
to see if the store logo image realy exists and if it doesn't add it there.
Did you check code in that class ($this) and/or its parent class? You'll see function inserLogo there.