close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

I need a solution to center images vertically when using Fixed width and height

Thread began 12/10/2018 1:27 pm by Dave Buchholz | Last modified 12/13/2018 11:32 am by Ray Borduin | 66 views | 11 replies |

Dave BuchholzBeta Tester

I need a solution to center images vertically when using Fixed width and height

When doing this new the image is is at the top with the white space below filled with the fill color defined

Sign in to reply to this post

Ray BorduinWebAssist

You could probably update the file: webassist/file_manipulation/helperphp.php

On line 1021 you should find:

imagecopyresampled($tmp,$src,0,0,0,0,$newWidth,$newHeight,$width,$height);



update that to:

imagecopyresampled($tmp,$src,round(($width-$newWidth)/2),round(($height-$newHeight)/2),0,0,$newWidth,$newHeight,$width,$height);
Sign in to reply to this post

Dave BuchholzBeta Tester

Thanks Ray, that gave me the clue I needed to modify the code.

Sign in to reply to this post

Ray BorduinWebAssist

What was the correct modification?

Sign in to reply to this post

Dave BuchholzBeta Tester

Ray,

imagecopyresampled($tmp,$src,0,round(($height-$newHeight)),0,0,$newWidth,$newHeight,$width,$height);



This is what I ended up using for my needs

Sign in to reply to this post

Ray BorduinWebAssist

It seems like that would move it to the bottom, not center it. That centers the image? I'm going to have to play with it so I can get my head around why that works.

Sign in to reply to this post

Dave BuchholzBeta Tester

It worked for me because of how thin the image I am working with is, see link in PM

Sign in to reply to this post

anonymous

Thanks for the link. I still don't quite understand why it works, but I'll set it up in a test environment and see if I can get my head around it later today.

Sign in to reply to this post

Dave BuchholzBeta Tester

No worries, your original code pushed the image off to the left for me.

Sign in to reply to this post

Ray BorduinWebAssist

Thanks for the update... I'm going to play around with it today.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...