Page 1 of 1

Using CG Smart Image with CG Blog

Posted: Tue Sep 17, 2013 1:11 am
by delve2013
my client is uploading huge images to her blog, and I would like CG smart image to control the size of the images.

Can someone please explain what smarty code I need to add to my CGBlog detail template in order to show the image.

I have created an alias in CG Smart Image called "blog_img".

I just need a hand getting this into CGBlog.

???

Re: Using CG Smart Image with CG Blog

Posted: Tue Sep 17, 2013 7:13 am
by Recon
1) Create Image Field Definition name "CGimage"
2) Put this to your CGBlog template

{assign var='path value=$entry->file_location}
{assign var=image value=$entry->CGimage}

3) call smart image:

{CGSmartImage src1=$path src2=$image filter_croptofit="350,250,tc"} or filters what you need

Re: Using CG Smart Image with CG Blog

Posted: Tue Sep 17, 2013 7:45 am
by velden
I'd suggest:

Code: Select all

{CGSmartImage src1=$entry->file_location src2=$entry->CGimage filter_croptofit="350,250,tc"} or filters what you need
(Where image field definition name is 'CGImage')

Re: Using CG Smart Image with CG Blog

Posted: Tue Sep 17, 2013 10:39 am
by delve2013
Thank you guys, I've got it working.

BUT..

How would the client go about adding more than one image to a blog post using this method?

Right now, they are using the new field definition to browse, and add an image. The CG smart image is not working for any images being added into the WYSIWYG area, ideally I would need this method to work.

Re: Using CG Smart Image with CG Blog

Posted: Tue Sep 17, 2013 11:45 am
by velden
Read the help of CGSmartImage. It does support that.

Re: Using CG Smart Image with CG Blog

Posted: Tue Sep 17, 2013 1:59 pm
by delve2013
I've read the help and I still can't figure it out.
The examples it provides in the help section are for single images, and the cgsi_convert tag only works for regular {content} tags and does not work for the blog. I've tried wrapping cgsi_convert around my blog {content} tag and it fails to render the content when viewed in the browser.

Re: Using CG Smart Image with CG Blog

Posted: Wed Sep 25, 2013 7:25 pm
by Dr.CSS
I would teach my client how to optimize images for the web and to not waste bandwidth, server side storage of large images that you have to try and change/resize to work on the web...

Just mho...