Magento product resize image issue - magento-1.7

my server getting too slow due magento's resize image. i am using following code for display image
echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(250,250)
This is load actual image (if i upload havy image like 2mb,3mb ) if i am not using resize function but if i use this function then its always resize it to 250x250 that makes server extra work of resizing image which can be done once at uploading image
i just want to avoid this resize process so every time image will not resize it should be resized when we uploading in magento when create a product. please give me solution

just skip the resizing. Everything is done in __toString() so if you remove the resize() there is no resizing and the file is only copied to the cache.
EDIT
It is important that you have the right small image uploaded in the backend. You can upload multiple images. And set three (in standard installation image, small_image and thumbnail) in the backend. These images can be access via
$this->helper('catalog/image')->init($_product, 'IMAGE_TYPE')
So if you upload a 250x250px image, mark it as thumbnail then you can remove the resize and everything works fine.
What you can do - but don't ask me how - is to put the resized images into the cache. But there are a lot of problems, after inserting them, e.g. flush the image cache -> all images are deleted

Related

TYPO3: Rotate an image with Imagick and update the processed files

I let users upload images to fileadmin when they're logged in in the frontend.
So far so good, this works.
Now some images (especially when uploaded form mobile phones) are rotated (if taken in landscape mode, for example).
I tried using Imagick to autorotate those images upon upload, but it seems at least the IPhone doesn't have proper EXIF-data in the image (images taken in HEIC-Format, seem to be converted to jpgs when uploaded and then lose all EXIF-Data). At least the getImageOrientation-method from Imagick returns an invalid orientation.
Now, to overcome this, I've created a function for the users so they can rotate their images themselves.
This works as well. The original image gets rotated as expected.
BUT: I need to update the processed images as well, since they still reflect the unrotated image.
How would I do that without manually deleting the processed-files in the installer?
I mean, I could create a new image and delete the old one, but that seems like some unnecessary labor.
Any ideas?

Want to resize a image with better resolution in swift

I have a image which is uploaded in the image cloud-cloudinary using the API.The response of the upload gives me the cloudinary uploaded url.
Example of one image is as given:
This image is of 120*67 which is uploaded.Now in my app,it looks like this.
The width of my image is as per the phone screen width and the height is fixed to 324.Now i want to resize this 120*67 image to the width and height of my image in the app without losing its clarity.I have made the content mode as scale to fill for the imageview.
Generally, scaling up (non vectorized) images without compromising their quality is not possible (without machine learning). Some software programs have complex algorithms to help with upscaling, but that's also to a limited extent.
You should upload a larger version of your image to Cloudinary, and request it downscaled to the desired resolution.
You should also check out responsive layout design.
If the image is vectorized (e.g - SVG), you need to make sure you're not requesting a rasterized version of it. I.E -
https://res.cloudinary.com/<cloud name>/image/upload/fl_sanitize/<image name>.svg
will keep the image vectorized.

How to modify an image before caching it with HJCache?

I've been using HJCache to do asynch image loading and caching. It works great, but I have use case where I can't seem to get HJCache to handle.
I have an images loaded in a table view, and the same images appears bigger when you select the corresponding tableviewcell. HJCache does a great job of caching the image so it doesn't have to reload it after getting it once. However, I would like to resize the image (and do some cropping, etc) in the tableview thumbnail. The problem is, that it's a very expensive task to do and it ends up lagging the scrolling of the tableview if it's done in the drawRect of the cell.
I would like to cache the "modified" image along with the original so that the image processing only has to happen once. How do i get an instance of the already cached UIImage, apply the processing, and then add that one to the cache as well (with a different oid). I only seem to be able to cache an image by giving a URL.
Thank you,
Matt

iPhone : Problem while displaying captured image in UIWebView

I am displaying graph by capturing image and loading into a webView using loadHTMLString method.
The images come fine when displayed the first time. But it does not seem to change when I recapture the image which is different.
Also I have checked that the image name is same and the new image is recaptured every time.
It seems to be some issue with UIWebView reloading.
what could be wrong ?
If the same image with the same name is being captured, it may be cached in the UIWebView, causing it to display as the initial image instead of the updated images. If there's a way to use the reload function of the webview (which, in a browser will often check for updates to images), this might help.
If that doesn't solve it, I'd make sure that you're not somehow saving and appending the captured HTML to a variable, causing the new text to be appended to the end of the variable and not loaded.

question regarding <img> and thumbnails

I have a photo site which renders previews of my photos in a tag when i hover some dots. (see http://johanberntsson.se/photo/).
But it feels kinda stupid to load the full image in to an img-tag. Because as far as i know, theres no difference between loading the image with its original size versus adding height and width attributes to it.
Got any suggestions how to improove my preview function?
Thanks
As far as client side is concerned, there's nothing you can do. If you're worried about how long it takes the image to load, you could always pre-load them with javascript. The only other thing would be to create a few sizes of your image on the server.
You should resize the image to get better speed. Here's an example in php
//Blob if image in database
$blob = mysql_fetch_...();
//else blob point to filename
$blob = "filename.jpg";
$gd = imagecreatefromstring($blob);
$resized = imagecreatetruecolor(X, Y); // new image dimensions
imagecopyresampled(....);
imagejpeg($resized);
Loading all the thumbnails in a giant sprite image used as a background image. Then position the background a the right place to have the right image a the right place.
This will improve the loading speed by loading only 1 image and allow the browser to cache the request of the image so, next time the user come to your site, it will load pretty fast.