we use Zoom Full Page Cache from ezapps for Magento. The code can be found here:
https://github.com/ezapps/Zoom-Magento-FPC
Although we see that development has been silent for a while we still enjoy this product. We only see now that working with a multistore that site A is loaded in site B. But it is supposed to support multistore.
Our question is: Has anyone come across this issue for a multisite and know how to fix it?
merci
Zoom looks for:
self::$STORE = isset($_SERVER['MAGE_RUN_CODE'])
The problem is that the ezzoom.php is the first line of PHP code in index.php
What yoou need to do is place the IF ELSE code for store selection based on domain ABOVE the call to ezzoom.php in index php
then it works fine
Now the code is like
$call to ezzoom.php on first line
OTHER CODE HERE
switch($_SERVER['HTTP_HOST']) {
case 'winkel1.nl':
Mage::run('winkel2', 'website');
break;
case 'winkel2.nl':
Mage::run('winkel2', 'website');
break;
default:
Mage::run();
break;
}
and this needs to be
switch($_SERVER['HTTP_HOST']) {
case 'winkel1.nl':
Mage::run('winkel2', 'website');
break;
case 'winkel2.nl':
Mage::run('winkel2', 'website');
break;
default:
Mage::run();
break;
}
$call to ezzoom.php on first line
OTHER CODE HERE
Then the environment variable is known by ezzoom
Related
i've been looking for a solution for the whole day but don't seem to be able to find a proper solution.
The problem is (i think) quite simple. When an image is uploaded on my page it is then displayed in an img element. Now for some reason it is rotated by itself from portrait to landscape.
I cut the middle man and connected the img tag to the path.
Problem persists.
If i open it in ps and save it as a new jpeg it is fixed but that is not a viable choice since images will be uploaded directly from clients.
In not other program (ps, paint, photos, photos3d) does that issue exist
In my digging around i found that that is propably caused from the exif data of the image.
Everything else ignores that data, or reads it correctly idk.
Can anyone please tell me how to fix that?
I tried adding image-orientation:0deg and image-orientation:from-image to no result.
Also, just for my sanity's sake, does anyone know WHY this would be a problem?
EDITThis does not happen on firefox. That being said i cannot force everyone to avoid chrome
Thanks in advance
Ok so i looked everywhere and found some ways to rotate the image client side and added css to make it look legit. Then i realized that all that was wasted since it would cause the image to overrotate in browsers that displayed it correctly.
Ended up taking it to server side and fixing it there (rotating based on exif and the removing the exif data)
I will include the controller code
public JsonResult NormalizeOrientation(HttpPostedFileBase file)
{
Image img = Image.FromStream(file.InputStream);
if (Array.IndexOf(img.PropertyIdList, 274) > -1)
{
var orientation = (int)img.GetPropertyItem(274).Value[0];
switch (orientation)
{
case 1:
// No rotation required.
break;
case 2:
img.RotateFlip(RotateFlipType.RotateNoneFlipX);
break;
case 3:
img.RotateFlip(RotateFlipType.Rotate180FlipNone);
break;
case 4:
img.RotateFlip(RotateFlipType.Rotate180FlipX);
break;
case 5:
img.RotateFlip(RotateFlipType.Rotate90FlipX);
break;
case 6:
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
break;
case 7:
img.RotateFlip(RotateFlipType.Rotate270FlipX);
break;
case 8:
img.RotateFlip(RotateFlipType.Rotate270FlipNone);
break;
}
// This EXIF data is now invalid and should be removed.
img.RemovePropertyItem(274);
}
MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Jpeg);
return Json(new { base64imgage = Convert.ToBase64String(ms.ToArray()) }
, JsonRequestBehavior.AllowGet);
}
I am using unveil.js to load a site more quickly.
I have a white div that blocks the content, which I want to disappear after the first images have loaded.
I though I could just count the images, but I realize that some of the latter ones could just load first (which normally happens because there is a threshold parameter which loads the ones that follow on the scroll).
Could someone help me with a smart way to do this?
Here's my code and the crappy solution:
$("img").unveil(2000, function() {
$(this).load(function(){
if(imageCount >= 4){
$(".white-cover").fadeOut("slow");
imageCount = 0;
}
Since unveil changes the src attribute, you can use jQuery to listen to an attribute change which indicate that an image has been replaced.
$(document).ready(function(){
$("#selected-date-range").change(function(){
alert( $("#selected-date-range").attr("value") );
});
});
In case I understand your problem correctly, I would use:
$(document).ready(function(){
// all images are loaded
}
Does this help you?
Want to increase the size of an image on the Product view page in Magento 1.8 CE, Modern theme.
I tried to change the values from 265 to 400 in the following files:
/app/design/frontend/default/modern/template/catalog/product/view/media.phtml
/app/design/frontend/base/default/template/catalog/product/view/media.phtml
/app/design/frontend/default/default/template/featurezoom/media.phtml
(because this extension was installed. I have a feeling that the problem might be here, but cannot find what)
/app/design/frontend/base/default/template/productdetails/media.phtml
even in the /app/code/core/Mage/Catalog/Model/Product.php
Changed the
css file .product-view .product-img-box .product-image {width: 400px}
Flushed the cache, cleared the folder /media/catalog/product/cache/
But something still keeps creating the 265x265 folder in the cache
Here is the page
Thought it would be simple task, but already spent the entire day on it.
Any help is appreciated
So I believe I found the solution. Thanks Nikitas for the suggestion to use the debug mode.
Not sure if this is proper way, but this works.
The file I edited was frontend/base/default/template/productdetails/media.phtml
Initial code was
/* Main Image Size */
if (strstr($_productDetails['mainImageSize'], '_')) {
$mainImageSize = explode('_', $_productDetails['mainImageSize'], 2);
} else {
$mainImageSize = array(265, 265);
}
Changing the sizes in the ELSE didn't help, so I changed it in the IF statement like this
/* Main Image Size */
if (strstr($_productDetails['mainImageSize'], '_')) {
/* $mainImageSize = explode('_', $_productDetails['mainImageSize'], 2); */
$mainImageSize = array(400, 400);
} else {
$mainImageSize = array(265, 265);
}
If you know better solution or have any suggestions, that would be helpful.
Thanks
Now I'll have to play with the zoom because it increased the zoom box
Just go to
/app/design/frontend/yourtheme/default/template/catalog/product/view/media.phtml
Find the code
'image')->resize(436)
and just give your image dimension in here like
'image')->resize(300,436)
This error shows up when run the program and try to load an image:
A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll
An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll
Additional information: The parameter is invalid.
Here is my code:
Basically, there is a numericUpDown, a button, an openFileDialog and a pictureBox. The user changes the numericUpDown's value, depending on which picture he wants to load (the user doesn't have to open the openFileDialog). For example, if the user chooses "3" as a value for the numericUpDown, the FileName of the openFileDialog will be:
Public:
void Set_FilePath()
{
int n = (int)numericUpDown1->Value;
switch (n)
{
case 1: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg"; break;
case 2: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"; break;
case 3: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg"; break;
case 4: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Jellyfish.jpg"; break;
case 5: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Koala.jpg"; break;
case 6: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg"; break;
case 7: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"; break;
case 8: openFileDialog1->FileName = "C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg"; break;
}
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Bitmap^ myImage;
Set_FilePath();
myImage = gcnew Bitmap( openFileDialog1->FileName );
pictureBox1->SizeMode = PictureBoxSizeMode::StretchImage;
pictureBox1->Image = dynamic_cast <Image^> (myImage);
}
My attempt to fix it:
I thought that i didn't copy the directions of the images correctly. So i changed the code to:
if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
MessageBox::Show(openFileDialog1->FileName);
myImage = gcnew Bitmap( openFileDialog1->FileName );
pictureBox1->SizeMode = PictureBoxSizeMode::StretchImage;
pictureBox1->Image = dynamic_cast <Image^> (myImage);
}
This is working perfectly. Also, a messagebox that shows the filename of openFileDialog is appeared... The directions of the images that are correct... I don't know what is wrong with my program. The problem is that i don't want the openFiledialog to be appeared.
(I am using Visual Studio C++ 2010, the application is made in windows form), Any help would be appreciated.
Thanks..
Exceptions raised by the Image and Bitmap classes are not very informative. You can get an "The parameter is invalid" exception for several reasons. It could be an image file that's corrupted, not that likely in your case since you are using stock Windows image files. It can also be caused by an image that's too large to fit in the available virtual memory address space. You'd like an OutOfMemoryException but GDI+ is goofy about it.
That's the more likely cause, your program is pretty likely to bite the dust like that when you run it for a while. Images can require a lot of unmanaged virtual memory to store their pixel data. And that should be released when you no longer use the image. The garbage collector will do that for you, but it isn't all that quick about it. Certainly an issue with the Bitmap class, it uses very little GC heap so isn't terribly likely to trigger a garbage collection often enough to keep you out of trouble.
Which is why it implements the IDisposable interface. The Dispose() method gets that memory released early. You are not calling it.
You'll need to fix that in your code, like this:
delete picureBox1->Image;
try {
myImage = gcnew Bitmap( openFileDialog1->FileName );
pictureBox1->Image = myImage;
}
catch (Exception^ ex) {
pictureBox1->Image = nullptr;
MessageBox::Show(ex->Message);
}
Note the added delete operator call, that's the one that calls IDisposable::Dispose(). It gets rid of the old image, the one you don't need anymore because you are going to display another image. The try/catch ensures that your program keeps running when the chips are down, dealing with a bad image file or a monster one that just can't fit in available memory. The kind that you deal with by targeting x64 so you get a 64-bit program.
I know that in catalog.xml this line effects all layouts:
<action method="setColumnCount"><columns>5</columns></action>
But I want to change the number of columns based upon specific page layouts, i.e.: 2columns with left bar, 3 columns, etc.
This is what someone said to do but I am not sure I was adding the update tag in the right spot because it didn't seem to work. Also if you read the comments they say once you turn caching back on it breaks it:
http://www.lotusseedsdesign.com/blog/change-grid-view-column-4-product-listing
So does anyone know how to use the addColumnCountLayoutDepend method or any other way to change the number of columns on the product grid specific to the page layout?
For sub category page, in app/design/frontend/Your Interface/layout/catalog.xml change columns value the following line :
<action method="setColumnCount"><columns>4</columns></action>
For root category page, in app/design/frontend/Your Interface/template/catalog/product/list.phtml find the following code in "Grid Mode" section and change with appropiate value :
<?php $_columnCount = $this->getColumnCount(); ?>
like
<?php $_columnCount = 4; ?>
A bit old question (almost 3 years :D) but I found an interesting solution to this on Kathir 'Sid' Vel's site
For this you will edit catalog/product/list.phtml template.
Find the row:
<?php $_columnCount = $this->getColumnCount(); ?>
and replace with the code bellow or comment the line and add after it the code.
<?php
/* Get the layout's page template */
$pageLayoutRootTemplate = $this->getLayout()->getBlock('root')->getTemplate();
/* Set the column count based on the layout template used */
switch ($pageLayoutRootTemplate) {
case 'page/1column.phtml':
$_columnCount = 4;
break;
case 'page/2columns-left.phtml':
$_columnCount = 3;
break;
case 'page/2columns-right.phtml':
$_columnCount = 3;
break;
case 'page/3columns.phtml':
$_columnCount = 2;
break;
default:
$_columnCount = 3;
break;
}
?>
There are a few ways to change the column counts. You can try each method to see what suits you.
1) Watch this tutorial: http://www.youtube.com/watch?v=wNbV34v72a0
Here's the code you need to make it work.
<reference name="product_list">
<action method="setColumnCount"><count>4</count></action>
</reference>
2) If the above fails, use this in whatever CMS page you want to change the columns. So for example: if you have a CMS page for displaying a specific category, use this. This is especially great for displaying a specific category products and setting the number of items per row at the same time. Past the following code in your CMS page:
{{block type="catalog/product_list" category_id="42" template="catalog/product/showroom.phtml" columnCount="4"}}
You can change the columnCount number from 4 to whatever you want. You can get the category id by clicking on a category under your magento admin/category/manage category/
This is very important! Sometimes, when you do everything right in either of the two steps above, the items per row still does not change. The reason can easily be a CSS issue. So that leads to step 3:
3) Open your template's CSS and search for .products-grid
Make sure the width is set to a number high enough to be able to display the number of items per row you want, without having to push down overflowing items. In my case, I tried all I could to have a 4 items per row but failed, until I noticed in the CSS that my .col1-layout .products-grid had a width of 750px. I changed the width to 995px and voila, step 2 worked flawlessly.
This is late but I hope it helps someone out there.
Go to app\design\frontend\base\default\layout\catalog.xml
then go to Go to line 85 and fine the code. and find "catalog/product_list_toolbar" then customize the products according to your need.
Simplest way to change it is from the configuration tab
System->Configuration-> catalog tab-catalog->frontend you can change it easily from your magento backend.