I use Orchard cms. I want when images uploaded, the images get watermark automatically. How can I do this?
To add watermark automatically, you have to add a OnPublished handler for ImagePart as following:
OnPublished<ImagePart>((context, part) => {
var mediaPart = part.As<MediaPart>();
// Here you can add watermark code
});
If you want to add the watermark on the original uploaded image, you have to call it from the handler directly, but if you want to use media processing module mechanism (Which will keep the original image as is, and create a new one with filters applied and save it in _Profiles folder), then you can add a new implementation for IImageFilterProviderto add a new filter for Orchard media processing pipeline.
Finally, I recommend you to use ImageResizer.Plugins.Watermark plugin to achieve this, because Orchard already use ImageResizer component as default image processing framework.
Update: Please refer to this link for complete implementation, or this repo for source code.
This should be possible by providing a custom implementation of IImageFilterProvider. Search for this interface in the solution, you will find a ResizeFilter and FormatFilter in the Orchard.MediaProcessing module as an example.
Also, there are some articles like http://www.davidhayden.me/blog/developing-custom-image-filters-in-orchard-cms.
Related
Hello I'm using backpack which uses elfinder as a file manager, and i want to achive te following:
when an image is uploaded I want to create 3 copies of it
one with it real dimension
the second is 200x200
and the third 50x50
Note: Like WordPress which has this mechanism built in (uploading multiple sizes of the image)
Unfortunately, there's no easy way to do that thanks to elFinder itself. The PHP package for elFinder doesn't have events or anything like that, for you to customize its upload behaviour. And doing it in Javascript would probably not be a good idea.
But thanks to Backpack, there's one thing you could do, that could be useful. You can use Model Events inside your CrudControllers, to do stuff after the cretate/update form has been submitted. For example:
when the updated event happens, check if that file that was upload (with real dimensions) has thumbnails; if so, do nothing;
if not, create the thumbnails using a library like Intervention image that is already included in Backpack;
So it would looks something like this:
public function setup()
{
// ...
Product::saved(function($entry) {
if (!$entry->hasThumbnailsForAttachment()) {
$entry->generateThumbnailsForAttachment()
}
});
}
Then in your Model you could create these two methods, hasThumbnailsForAttachment() and generateThumbnailsForAttachment().
Hope it helps!
I'm trying to load all images in the product page , but i don't want to resize them.
Does anybody know a simple solution tot do that?
The opencart version is 2.1.0.2
In-order to retrieve images without being re-sized on the product page, you need not re-size the images in the product controller file.
So in the Product Controller File, locate that in /catalog/controller/product/product.php
In the public function index()
Look out for $this->model_tool_image->resize remove the function call and use the link to the image instead to return to the template HTTPS_SERVER . 'image/'. $image_variable provided HTTPS_SERVER is defined in /config.php
Note: $image_variable could be $product_info['image'] or $result['image'] , use your best judgement.
Tip: Use vqmod as you would be modifying the core controller file
In order to use vQmod (according to the process described previously), you can take a look to this method for working with real images instead of thumbnails.
Note that there are other possible suggestions, such as:
OCmod which can be found here
Image Autosize extension which can be found here
Please tell me how to change the image source in magento dynamically.say I want that after every 10 seconds I want to change the source of image.
now I have define a static block which contain image src with id banner..
now my question is where should I define for changing the image source and how to change the source.
I would suggest looking into a jQuery based image rotator. There are some simple examples out there such as this one:
http://burnmind.com/tutorials/how-to-create-a-simple-automatic-image-rotator-using-jquery
Also be careful not to cause conflicts with jQuery and Prototype. You can use this method to avoid this from happening.
Refer to these links: They are free extensions which may serve your purpose.
http://expertmagentodevelopers.wordpress.com/2012/04/24/download-magento-banner-slider-extensions-free/
http://www.magentocommerce.com/magento-connect/banner-slider-3912.html
http://www.magentocommerce.com/magento-connect/Interakting.com/extension/2255/interakting-slider#overview
Here is a scenerio, on my products page I want to add an image of the product dimensions but for this image I want to use thumbnail which is different from the actual image which will say Dimensions. This will be applied to all the products across the store. So there will be one thumnail image for all the products that will be associated with it’s dimensional image. I want to show it on the gallery page as last image.
Any help would be greatly appreciated.
Regards,
Avian
If I'm understanding you correctly, you just want every product to have a thumbnail that can be set to be one of several images.
You will need to create a custom attribute for your products, and then programmatically set your current inventory to your defaults. (Or manually change them) There is a knowledgebase article that will assist you with custom options (if applicable), or another article I found via Google to assist in custom attributes.
It's likely not the best way of doing it, but an example of the JavaScript method I was talking about is simply to add the following into a JS file on your server.
document.observe("dom:loaded", function() {
$$('.catalog-product-view .image-thumb:last img').each(function(item){item.src = 'http://domain.com/path/to/image.jpg'});
}
Does there exist anything akin "UberSelectionWidget for images?" I'd like to get rid of direct-upload image fields and make all images to be managed through an image bank folder.
1) In all use cases upload image to image-bank folder first
2) Pick image from the folder by using some sort of image friendly selection widget (both Archetypes, Dexterity)
This way adding images would be unified within TinyMCE editor and news content items.
The problem, however, is that I cannot find any examples for reference picker for images solution.
Please see also Making TinyMCE image pick dialog point to a default folder on Plone
I am willing to replace News Item with my own content type just to get around this problem.
This product helped me in a Plone 3 project:
http://plone.org/products/upload-reference-widget
I had to customize it a little but I think it's a good base to start with.
No Dexterity support IIRC.
Use ReferenceField instead of ImageField in your content types, it make the job done.
You can extend 'News Item' type by using schemaextender.
Bonus:
But asking for people to first add image before adding a news is weird. As widget you must use uploadreference widgets for archetypes as mentionned by marcosfromero . It works and let you add an images without going away of your addform.
I'm not sure but there is no z3cform widget at the moment to achieve this (upload & create ref), may be someone can create it or get me wrong ?